Class CaseToCoalesceRule
java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.druid.sql.calcite.rule.CaseToCoalesceRule
- All Implemented Interfaces:
org.apache.calcite.rel.rules.SubstitutionRule,org.apache.calcite.rel.rules.TransformationRule
public class CaseToCoalesceRule
extends org.apache.calcite.plan.RelOptRule
implements org.apache.calcite.rel.rules.SubstitutionRule
Rule that un-does the rewrite from
SqlCoalesceFunction.rewriteCall(org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.SqlCall).
Important because otherwise COALESCE turns into a gnarly CASE with duplicated expressions. We must un-do the
rewrite rather than disable SqlValidator.Config.callRewrite(), because we rely on validator rewrites
in other cases, such as EarliestLatestAnySqlAggregator.EARLIEST and
EarliestLatestAnySqlAggregator.LATEST.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.calcite.plan.RelOptRule
org.apache.calcite.plan.RelOptRule.ConverterRelOptRuleOperand -
Field Summary
Fields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.calcite.plan.RelOptRule
any, convert, convert, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unorderedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.calcite.rel.rules.SubstitutionRule
autoPruneOld
-
Constructor Details
-
CaseToCoalesceRule
public CaseToCoalesceRule()
-
-
Method Details
-
onMatch
public void onMatch(org.apache.calcite.plan.RelOptRuleCall call) - Specified by:
onMatchin classorg.apache.calcite.plan.RelOptRule
-