Package org.apache.calcite.test
Class CustomTypeSystems
java.lang.Object
org.apache.calcite.test.CustomTypeSystems
Custom implementations of
RelDataTypeSystem
for testing.-
Field Summary
Modifier and TypeFieldDescriptionstatic final RelDataTypeSystem
Type system that supports negative scale and has rounding modeRoundingMode.DOWN
.static final RelDataTypeSystem
Type system that supports negative scale and has rounding modeRoundingMode.HALF_UP
.static final RelDataTypeSystem
Type system with rounding behaviorRoundingMode.HALF_UP
. -
Method Summary
Modifier and TypeMethodDescriptionstatic RelDataTypeSystem
withMaxPrecision
(RelDataTypeSystem typeSystem, Function<SqlTypeName, Integer> maxPrecision) Decorates a type system so thatRelDataTypeSystem.getMaxPrecision(SqlTypeName)
returns a given value.static RelDataTypeSystem
withMaxScale
(RelDataTypeSystem typeSystem, Function<SqlTypeName, Integer> maxScale) Decorates a type system so thatRelDataTypeSystem.getMaxScale(SqlTypeName)
returns a given value.static RelDataTypeSystem
withMinScale
(RelDataTypeSystem typeSystem, Function<SqlTypeName, Integer> minNumericScale) Decorates a type system so thatRelDataTypeSystem.getMinScale(SqlTypeName)
returns a given value.static RelDataTypeSystem
withRoundingMode
(RelDataTypeSystem typeSystem, RoundingMode roundingMode) Decorates a type system so thatRelDataTypeSystem.roundingMode()
returns a given value.
-
Field Details
-
ROUNDING_MODE_HALF_UP
Type system with rounding behaviorRoundingMode.HALF_UP
. (The default implementation isRoundingMode.DOWN
.) -
NEGATIVE_SCALE
Type system that supports negative scale and has rounding modeRoundingMode.DOWN
. -
NEGATIVE_SCALE_ROUNDING_MODE_HALF_UP
Type system that supports negative scale and has rounding modeRoundingMode.HALF_UP
.
-
-
Method Details
-
withRoundingMode
public static RelDataTypeSystem withRoundingMode(RelDataTypeSystem typeSystem, RoundingMode roundingMode) Decorates a type system so thatRelDataTypeSystem.roundingMode()
returns a given value. -
withMaxPrecision
public static RelDataTypeSystem withMaxPrecision(RelDataTypeSystem typeSystem, Function<SqlTypeName, Integer> maxPrecision) Decorates a type system so thatRelDataTypeSystem.getMaxPrecision(SqlTypeName)
returns a given value. -
withMaxScale
public static RelDataTypeSystem withMaxScale(RelDataTypeSystem typeSystem, Function<SqlTypeName, Integer> maxScale) Decorates a type system so thatRelDataTypeSystem.getMaxScale(SqlTypeName)
returns a given value. -
withMinScale
public static RelDataTypeSystem withMinScale(RelDataTypeSystem typeSystem, Function<SqlTypeName, Integer> minNumericScale) Decorates a type system so thatRelDataTypeSystem.getMinScale(SqlTypeName)
returns a given value.
-