Package org.apache.druid.sql.calcite.rel
Class PartialDruidQuery
java.lang.Object
org.apache.druid.sql.calcite.rel.PartialDruidQuery
Builder for a Druid query, not counting the "dataSource" (which will be slotted in later).
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuild(DataSource dataSource, RowSignature sourceRowSignature, PlannerContext plannerContext, org.apache.calcite.rex.RexBuilder rexBuilder, boolean finalizeAggregations, boolean applyPolicies) build(DataSource dataSource, RowSignature sourceRowSignature, PlannerContext plannerContext, org.apache.calcite.rex.RexBuilder rexBuilder, boolean finalizeAggregations, boolean applyPolicies, VirtualColumnRegistry virtualColumnRegistry) booleancanAccept(PartialDruidQuery.Stage stage) static PartialDruidQuerycreate(org.apache.calcite.rel.RelNode inputRel) static PartialDruidQuerycreateOuterQuery(PartialDruidQuery inputQuery, PlannerContext plannerContext) booleandoubleEstimates the per-row cost of running this query.org.apache.calcite.rel.core.Aggregateorg.apache.calcite.rel.core.Projectorg.apache.calcite.rel.core.Filterorg.apache.calcite.rel.type.RelDataTypeorg.apache.calcite.rel.RelNodegetScan()org.apache.calcite.rel.core.Projectorg.apache.calcite.rel.core.SortgetSort()org.apache.calcite.rel.core.Projectorg.apache.calcite.plan.RelTraitSetgetTraitSet(org.apache.calcite.plan.Convention convention, PlannerContext plannerContext) Get traits for this partial query.org.apache.calcite.rel.core.Filterorg.apache.calcite.rel.core.Windoworg.apache.calcite.rel.core.ProjectinthashCode()org.apache.calcite.rel.RelNodeleafRel()Returns the rel at the end of the query.mergeProject(org.apache.calcite.rel.core.Project newSelectProject) stage()Returns the stage corresponding to the rel at the end of the query.toString()withAggregate(org.apache.calcite.rel.core.Aggregate newAggregate) withAggregateProject(org.apache.calcite.rel.core.Project newAggregateProject) withHavingFilter(org.apache.calcite.rel.core.Filter newHavingFilter) withSelectProject(org.apache.calcite.rel.core.Project newSelectProject) withSort(org.apache.calcite.rel.core.Sort newSort) withSortProject(org.apache.calcite.rel.core.Project newSortProject) withWhereFilter(org.apache.calcite.rel.core.Filter newWhereFilter) withWindow(org.apache.calcite.rel.core.Window newWindow) withWindowProject(org.apache.calcite.rel.core.Project newWindowProject)
-
Method Details
-
create
-
createOuterQuery
public static PartialDruidQuery createOuterQuery(PartialDruidQuery inputQuery, PlannerContext plannerContext) -
getScan
public org.apache.calcite.rel.RelNode getScan() -
getWhereFilter
public org.apache.calcite.rel.core.Filter getWhereFilter() -
getSelectProject
public org.apache.calcite.rel.core.Project getSelectProject() -
getAggregate
public org.apache.calcite.rel.core.Aggregate getAggregate() -
getHavingFilter
public org.apache.calcite.rel.core.Filter getHavingFilter() -
getAggregateProject
public org.apache.calcite.rel.core.Project getAggregateProject() -
getSort
public org.apache.calcite.rel.core.Sort getSort() -
getSortProject
public org.apache.calcite.rel.core.Project getSortProject() -
getWindow
public org.apache.calcite.rel.core.Window getWindow() -
getWindowProject
public org.apache.calcite.rel.core.Project getWindowProject() -
withWhereFilter
-
withSelectProject
-
mergeProject
-
withAggregate
-
withHavingFilter
-
withAggregateProject
public PartialDruidQuery withAggregateProject(org.apache.calcite.rel.core.Project newAggregateProject) -
withSort
-
withSortProject
-
withWindow
-
withWindowProject
-
getRowType
public org.apache.calcite.rel.type.RelDataType getRowType() -
getTraitSet
public org.apache.calcite.plan.RelTraitSet getTraitSet(org.apache.calcite.plan.Convention convention, PlannerContext plannerContext) Get traits for this partial query. This is the traits fromleafRel(), plusRelCollationTraitDefifstage()isPartialDruidQuery.Stage.AGGREGATEorPartialDruidQuery.Stage.AGGREGATE_PROJECT(to represent the fact that Druid sorts by grouping keys when grouping).- Parameters:
convention- convention to include in the returned array
-
build
public DruidQuery build(DataSource dataSource, RowSignature sourceRowSignature, PlannerContext plannerContext, org.apache.calcite.rex.RexBuilder rexBuilder, boolean finalizeAggregations, boolean applyPolicies) -
build
public DruidQuery build(DataSource dataSource, RowSignature sourceRowSignature, PlannerContext plannerContext, org.apache.calcite.rex.RexBuilder rexBuilder, boolean finalizeAggregations, boolean applyPolicies, @Nullable VirtualColumnRegistry virtualColumnRegistry) -
canAccept
-
stage
Returns the stage corresponding to the rel at the end of the query. It will match the rel returned fromleafRel().- Returns:
- stage
-
leafRel
public org.apache.calcite.rel.RelNode leafRel()Returns the rel at the end of the query. It will match the stage returned fromstage().- Returns:
- leaf rel
-
estimateCost
public double estimateCost()Estimates the per-row cost of running this query. -
equals
-
hashCode
public int hashCode() -
toString
-