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
Nested ClassesModifier and TypeClassDescriptionstatic classImmutable way to store and pass precision and scale values.static classImmutable way to store and pass properties to get precision and scale for a given named column. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputePrecisionAndScale(RowSet rowSet, ColumnSource<?> columnSource) Compute an overall precision and scale that would fit all existing values in a column source.computePrecisionAndScale(Table table, 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 aPrecisionAndScalevalue from a object.static voidsetProperties(Properties props, BigDecimalUtils.PropertyNames names, BigDecimalUtils.PrecisionAndScale values) Set the given names and values in the suppliedPropertiesobject.
-
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 table, String colName) Compute an overall precision and scale that would fit all existing values in a table.- Parameters:
table- A Deephaven tablecolName- Column fortable, which should be ofBigDecimaltypeorcomponent type- Returns:
- A
BigDecimalUtils.PrecisionAndScaleobject result.
-
computePrecisionAndScale
public static BigDecimalUtils.PrecisionAndScale computePrecisionAndScale(RowSet rowSet, ColumnSource<?> columnSource) 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 columncolumnSource- AColumnSourceofBigDecimaltypeorcomponent type- Returns:
- A
BigDecimalUtils.PrecisionAndScaleobject result.
-
getPrecisionAndScaleFromColumnProperties
public static BigDecimalUtils.PrecisionAndScale getPrecisionAndScaleFromColumnProperties(BigDecimalUtils.PropertyNames propertyNames, Properties columnProperties, boolean allowNulls) Get aPrecisionAndScalevalue 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 suppliedPropertiesobject.- Parameters:
props- Properties where the given property names and values would be set.names- Property names to setvalues- Property values to set
-