Package io.deephaven.engine.util
Class BigDecimalUtils
java.lang.Object
io.deephaven.engine.util.BigDecimalUtils
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Immutable way to store and pass precision and scale values.static class
Immutable way to store and pass properties to get precision and scale for a given named column. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputePrecisionAndScale
(RowSet rowSet, ColumnSource<BigDecimal> source) Compute an overall precision and scale that would fit all existing values in a column source.computePrecisionAndScale
(Table t, String colName) Compute an overall precision and scale that would fit all existing values in a table.getPrecisionAndScaleFromColumnProperties
(BigDecimalUtils.PropertyNames propertyNames, Properties columnProperties, boolean allowNulls) Get aPrecisionAndScale
value from a object.static void
setProperties
(Properties props, BigDecimalUtils.PropertyNames names, BigDecimalUtils.PrecisionAndScale values) Set the given names and values in the suppliedProperties
object.
-
Field Details
-
INVALID_PRECISION_OR_SCALE
public static final int INVALID_PRECISION_OR_SCALE- See Also:
-
-
Constructor Details
-
BigDecimalUtils
public BigDecimalUtils()
-
-
Method Details
-
computePrecisionAndScale
Compute an overall precision and scale that would fit all existing values in a table.- Parameters:
t
- a Deephaven tablecolName
- a Column fort
, which should be ofBigDecimal
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 columnsource
- aColumnSource
ofBigDecimal
type- Returns:
- a
PrecisionAndScale
object result.
-
getPrecisionAndScaleFromColumnProperties
public static BigDecimalUtils.PrecisionAndScale getPrecisionAndScaleFromColumnProperties(BigDecimalUtils.PropertyNames propertyNames, Properties columnProperties, boolean allowNulls) Get aPrecisionAndScale
value from a object.- Parameters:
propertyNames
- The property names to read.columnProperties
- The object from where to read the propertiesallowNulls
- 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 suppliedProperties
object.- Parameters:
props
- Properties where the given property names and values would be set.names
- Property names to setvalues
- Property values to set
-