public class ReduceDecimalsRule extends RelOptRule
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.
Modifier and Type | Class and Description |
---|---|
private class |
ReduceDecimalsRule.BinaryArithmeticExpander
Expands a decimal arithmetic expression
|
private class |
ReduceDecimalsRule.CaseExpander
Expander that rewrites case expressions, in place.
|
private class |
ReduceDecimalsRule.CastArgAsDoubleExpander
An expander which casts decimal arguments as doubles
|
private class |
ReduceDecimalsRule.CastArgAsTypeExpander
An expander which casts decimal arguments as another type
|
private class |
ReduceDecimalsRule.CastExpander
Expands a decimal cast expression
|
private class |
ReduceDecimalsRule.CeilExpander
Expander that rewrites ceiling(decimal) expressions:
|
class |
ReduceDecimalsRule.DecimalShuttle
A shuttle which converts decimal expressions to expressions based on
longs.
|
private class |
ReduceDecimalsRule.ExpanderMap
Maps a RexCall to a RexExpander
|
private class |
ReduceDecimalsRule.FloorExpander
Expander that rewrites floor(decimal) expressions:
|
private class |
ReduceDecimalsRule.PassThroughExpander
An expander that substitutes decimals with their integer representations.
|
private class |
ReduceDecimalsRule.ReinterpretExpander
This expander simplifies reinterpret calls.
|
class |
ReduceDecimalsRule.RexExpander
Rewrites a decimal expression for a specific set of SqlOperator's.
|
Modifier and Type | Field and Description |
---|---|
static ReduceDecimalsRule |
INSTANCE |
description, operands, relBuilderFactory
Constructor and Description |
---|
ReduceDecimalsRule(RelBuilderFactory relBuilderFactory)
Creates a ReduceDecimalsRule.
|
Modifier and Type | Method and Description |
---|---|
Convention |
getOutConvention()
Returns the convention of the result of firing this rule, null if
not known.
|
void |
onMatch(RelOptRuleCall call)
Receives notification about a rule match.
|
any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutTrait, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
public static final ReduceDecimalsRule INSTANCE
public ReduceDecimalsRule(RelBuilderFactory relBuilderFactory)
public Convention getOutConvention()
RelOptRule
getOutConvention
in class RelOptRule
public void onMatch(RelOptRuleCall call)
RelOptRule
call.rels
holds the set of relational
expressions which match the operands to the rule;
call.rels[0]
is the root expression.
Typically a rule would check that the nodes are valid matches, creates
a new expression, then calls back RelOptRuleCall.transformTo(org.apache.calcite.rel.RelNode, java.util.Map<org.apache.calcite.rel.RelNode, org.apache.calcite.rel.RelNode>)
to
register the expression.
onMatch
in class RelOptRule
call
- Rule callRelOptRule.matches(RelOptRuleCall)
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.