Class BigDecimalUtils

java.lang.Object
io.deephaven.engine.util.BigDecimalUtils

public class BigDecimalUtils extends Object
Utilities to support BigDecimal exhaust. Parquet and Avro decimal types make a whole column decimal type have a fixed precision and scale; BigDecimal columns in Deephaven are, each value, arbitrary precision (its own precision and scale). For static tables, it is possible to compute overall precision and scale values that fit every existing value. For refreshing tables, we need the user to tell us.
  • Field Details

    • INVALID_PRECISION_OR_SCALE

      public static final int INVALID_PRECISION_OR_SCALE
      See Also:
  • Constructor Details

    • BigDecimalUtils

      public BigDecimalUtils()
  • Method Details

    • computePrecisionAndScale

      public static BigDecimalUtils.PrecisionAndScale computePrecisionAndScale(Table t, String colName)
      Compute an overall precision and scale that would fit all existing values in a table.
      Parameters:
      t - a Deephaven table
      colName - a Column for t, which should be of BigDecimal type
      Returns:
      a PrecisionAndScale object result.
    • computePrecisionAndScale

      public static BigDecimalUtils.PrecisionAndScale computePrecisionAndScale(RowSet rowSet, ColumnSource<BigDecimal> source)
      Compute an overall precision and scale that would fit all existing values in a column source. Note that this requires a full table scan to ensure the correct values are determined.
      Parameters:
      rowSet - The rowset for the provided column
      source - a ColumnSource of BigDecimal type
      Returns:
      a PrecisionAndScale object result.
    • getPrecisionAndScaleFromColumnProperties

      public static BigDecimalUtils.PrecisionAndScale getPrecisionAndScaleFromColumnProperties(BigDecimalUtils.PropertyNames propertyNames, Properties columnProperties, boolean allowNulls)
      Get a PrecisionAndScale value from a object.
      Parameters:
      propertyNames - The property names to read.
      columnProperties - The object from where to read the properties
      allowNulls - If true, do not throw when a property is missing, instead set the value to
      Returns:
      A object with the values read.
    • setProperties

      public static void setProperties(Properties props, BigDecimalUtils.PropertyNames names, BigDecimalUtils.PrecisionAndScale values)
      Set the given names and values in the supplied Properties object.
      Parameters:
      props - Properties where the given property names and values would be set.
      names - Property names to set
      values - Property values to set