Class LogicalUnnestRule

java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.druid.sql.calcite.rule.logical.LogicalUnnestRule
All Implemented Interfaces:
org.apache.calcite.rel.rules.SubstitutionRule, org.apache.calcite.rel.rules.TransformationRule

public class LogicalUnnestRule extends org.apache.calcite.plan.RelOptRule implements org.apache.calcite.rel.rules.SubstitutionRule
Recognizes a LogicalUnnest operation in the plan. Matches on the layout:
   LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{4}])
     RelNodeSubtree
     Uncollect
       LogicalProject(arrayLongNulls=[$cor0.arrayLongNulls])
         LogicalValues(tuples=[[{ 0 }]])
 
Translates it to use a LogicalUnnest like:
   LogicalUnnest(unnestExpr=[$cor0.arrayLongNulls])
     RelNodeSubtree
 
It raises an error for cases when LogicalCorrelate can't be translated as those are currently unsupported in Druid.
  • 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
    onMatch(org.apache.calcite.plan.RelOptRuleCall call)
     

    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, unordered

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LogicalUnnestRule

      public LogicalUnnestRule()
  • Method Details

    • autoPruneOld

      public boolean autoPruneOld()
      Specified by:
      autoPruneOld in interface org.apache.calcite.rel.rules.SubstitutionRule
    • onMatch

      public void onMatch(org.apache.calcite.plan.RelOptRuleCall call)
      Specified by:
      onMatch in class org.apache.calcite.plan.RelOptRule