Class ReduceDecimalsRule

All Implemented Interfaces:
TransformationRule

@Enclosing public class ReduceDecimalsRule extends RelRule<ReduceDecimalsRule.Config> implements TransformationRule
Rule that reduces decimal operations (such as casts or arithmetic) into operations involving more primitive types (such as longs and doubles). The rule allows Calcite implementations to deal with decimals in a consistent manner, while saving the effort of implementing them.

The rule can be applied to a LogicalCalc with a program for which RexUtil.requiresDecimalExpansion(org.apache.calcite.rex.RexNode, boolean) returns true. The rule relies on a RexShuttle to walk over relational expressions and replace them.

While decimals are generally not implemented by the Calcite runtime, the rule is optionally applied, in order to support the situation in which we would like to push down decimal operations to an external database.

See Also: