Class 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


      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.
      t - a Deephaven table
      colName - a Column for t, which should be of BigDecimal type
      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.
      rowSet - The rowset for the provided column
      source - a ColumnSource of BigDecimal type
      a PrecisionAndScale object result.
    • getPrecisionAndScaleFromColumnProperties

      public static BigDecimalUtils.PrecisionAndScale getPrecisionAndScaleFromColumnProperties(BigDecimalUtils.PropertyNames propertyNames, Properties columnProperties, boolean allowNulls)
      Get a PrecisionAndScale value from a object.
      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
      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.
      props - Properties where the given property names and values would be set.
      names - Property names to set
      values - Property values to set