Class DruidJoinQueryRel

java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.druid.sql.calcite.rel.DruidRel<DruidJoinQueryRel>
org.apache.druid.sql.calcite.rel.DruidJoinQueryRel
All Implemented Interfaces:
Cloneable, org.apache.calcite.plan.RelOptNode, org.apache.calcite.rel.RelNode

public class DruidJoinQueryRel extends DruidRel<DruidJoinQueryRel>
DruidRel that uses a JoinDataSource.
  • Method Details

    • create

      public static DruidJoinQueryRel create(org.apache.calcite.rel.core.Join joinRel, org.apache.calcite.rel.core.Filter leftFilter, PlannerContext plannerContext)
      Create an instance from a Join that is based on two DruidRel inputs.
    • getPartialDruidQuery

      public PartialDruidQuery getPartialDruidQuery()
      Description copied from class: DruidRel
      Returns the PartialDruidQuery associated with this DruidRel, and which can be built on top of. Returns null if this rel cannot be built on top of.
      Specified by:
      getPartialDruidQuery in class DruidRel<DruidJoinQueryRel>
    • withPartialQuery

      public DruidJoinQueryRel withPartialQuery(PartialDruidQuery newQueryBuilder)
      Specified by:
      withPartialQuery in class DruidRel<DruidJoinQueryRel>
    • buildJoinSourceDesc

      public static SourceDescProducer.SourceDesc buildJoinSourceDesc(SourceDescProducer.SourceDesc leftDesc, SourceDescProducer.SourceDesc rightDesc, PlannerContext plannerContext, org.apache.calcite.rel.core.Join joinRel, org.apache.calcite.rel.core.Filter leftFilter)
    • toDruidQuery

      public DruidQuery toDruidQuery(boolean finalizeAggregations)
      Description copied from class: DruidRel
      Convert this DruidRel to a DruidQuery. This must be an inexpensive operation, since it is done often throughout query planning. This method must not return null.
      Specified by:
      toDruidQuery in class DruidRel<DruidJoinQueryRel>
      Parameters:
      finalizeAggregations - true if this query should include explicit finalization for all of its aggregators, where required. Useful for subqueries where Druid's native query layer does not do this automatically.
    • toDruidQueryForExplaining

      public DruidQuery toDruidQueryForExplaining()
      Description copied from class: DruidRel
      Convert this DruidRel to a DruidQuery for purposes of explaining. This must be an inexpensive operation. This method must not return null.
      Specified by:
      toDruidQueryForExplaining in class DruidRel<DruidJoinQueryRel>
    • asDruidConvention

      public DruidJoinQueryRel asDruidConvention()
      Description copied from class: DruidRel
      Returns a copy of this rel with the DruidConvention trait.
      Specified by:
      asDruidConvention in class DruidRel<DruidJoinQueryRel>
    • getInputs

      public List<org.apache.calcite.rel.RelNode> getInputs()
      Specified by:
      getInputs in interface org.apache.calcite.rel.RelNode
      Specified by:
      getInputs in interface org.apache.calcite.plan.RelOptNode
      Overrides:
      getInputs in class org.apache.calcite.rel.AbstractRelNode
    • replaceInput

      public void replaceInput(int ordinalInParent, org.apache.calcite.rel.RelNode p)
      Specified by:
      replaceInput in interface org.apache.calcite.rel.RelNode
      Overrides:
      replaceInput in class org.apache.calcite.rel.AbstractRelNode
    • copy

      public org.apache.calcite.rel.RelNode copy(org.apache.calcite.plan.RelTraitSet traitSet, List<org.apache.calcite.rel.RelNode> inputs)
      Specified by:
      copy in interface org.apache.calcite.rel.RelNode
      Overrides:
      copy in class org.apache.calcite.rel.AbstractRelNode
    • getDataSourceNames

      public Set<String> getDataSourceNames()
      Description copied from class: DruidRel
      Get the set of names of table datasources read by this DruidRel
      Specified by:
      getDataSourceNames in class DruidRel<DruidJoinQueryRel>
    • explainTerms

      public org.apache.calcite.rel.RelWriter explainTerms(org.apache.calcite.rel.RelWriter pw)
      Description copied from class: DruidRel
      Overridden to ensure that subclasses provide a proper implementation. The default implementation from AbstractRelNode does nothing and is not appropriate.
      Overrides:
      explainTerms in class DruidRel<DruidJoinQueryRel>
    • deriveRowType

      protected org.apache.calcite.rel.type.RelDataType deriveRowType()
      Overrides:
      deriveRowType in class org.apache.calcite.rel.AbstractRelNode
    • computeSelfCost

      public org.apache.calcite.plan.RelOptCost computeSelfCost(org.apache.calcite.plan.RelOptPlanner planner, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
      Specified by:
      computeSelfCost in interface org.apache.calcite.rel.RelNode
      Overrides:
      computeSelfCost in class org.apache.calcite.rel.AbstractRelNode
    • toDruidJoinType

      public static JoinType toDruidJoinType(org.apache.calcite.rel.core.JoinRelType calciteJoinType)
    • computeLeftRequiresSubquery

      public static boolean computeLeftRequiresSubquery(PlannerContext plannerContext, DruidRel<?> left, org.apache.calcite.rel.core.Join joinRel)
    • computeRightRequiresSubquery

      public static boolean computeRightRequiresSubquery(PlannerContext plannerContext, DruidRel<?> right)
    • findExistingJoinPrefixes

      public static Set<String> findExistingJoinPrefixes(DataSource... dataSources)
    • computeJoinRowSignature

      public static Pair<String,RowSignature> computeJoinRowSignature(RowSignature leftSignature, RowSignature rightSignature, Set<String> prefixes)
      Returns a Pair of "rightPrefix" (for JoinDataSource) and the signature of rows that will result from applying that prefix.
    • getSomeDruidChild

      public static DruidRel<?> getSomeDruidChild(org.apache.calcite.rel.RelNode child)