Class DruidCorrelateUnnestRule
java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.druid.sql.calcite.rule.DruidCorrelateUnnestRule
public class DruidCorrelateUnnestRule
extends org.apache.calcite.plan.RelOptRule
This class creates the rule to abide by for creating correlations during unnest.
Typically, Calcite plans the unnest query such as
SELECT * from numFoo, unnest(dim3) in the following way:
80:LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3}])
6:LogicalTableScan(subset=[rel#74:Subset#0.NONE.[]], table=[[druid, numfoo]])
78:Uncollect(subset=[rel#79:Subset#3.NONE.[]])
76:LogicalProject(subset=[rel#77:Subset#2.NONE.[]], EXPR$0=[MV_TO_ARRAY($cor0.dim3)])
7:LogicalValues(subset=[rel#75:Subset#1.NONE.[0]], tuples=[[{ 0 }]])
DruidUnnestRule takes care of the Uncollect(last 3 lines) to generate a DruidUnnestRel
thereby reducing the logical plan to:
LogicalCorrelate
/ \
DruidRel DruidUnnestDataSourceRel
This forms the premise of this rule. The goal is to transform the above-mentioned structure in the tree
with a new rel DruidCorrelateUnnestRel which shall be created here.-
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, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
-
Constructor Details
-
DruidCorrelateUnnestRule
-
-
Method Details
-
matches
public boolean matches(org.apache.calcite.plan.RelOptRuleCall call) - Overrides:
matchesin classorg.apache.calcite.plan.RelOptRule
-
onMatch
public void onMatch(org.apache.calcite.plan.RelOptRuleCall call) - Specified by:
onMatchin classorg.apache.calcite.plan.RelOptRule
-