Class DrillRelMdDistinctRowCount
java.lang.Object
org.apache.calcite.rel.metadata.RelMdDistinctRowCount
org.apache.drill.exec.planner.cost.DrillRelMdDistinctRowCount
- All Implemented Interfaces:
org.apache.calcite.rel.metadata.MetadataHandler<org.apache.calcite.rel.metadata.BuiltInMetadata.DistinctRowCount>
public class DrillRelMdDistinctRowCount
extends org.apache.calcite.rel.metadata.RelMdDistinctRowCount
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.apache.calcite.rel.metadata.RelMetadataProvider
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetDistinctRowCount
(org.apache.calcite.plan.volcano.RelSubset rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.util.ImmutableBitSet groupKey, org.apache.calcite.rex.RexNode predicate) getDistinctRowCount
(org.apache.calcite.rel.core.Join rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.util.ImmutableBitSet groupKey, org.apache.calcite.rex.RexNode predicate) We need to override this method since Calcite and Drill calculate joined row count in different ways.getDistinctRowCount
(org.apache.calcite.rel.RelNode rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.util.ImmutableBitSet groupKey, org.apache.calcite.rex.RexNode predicate) Methods inherited from class org.apache.calcite.rel.metadata.RelMdDistinctRowCount
getDef, getDistinctRowCount, getDistinctRowCount, getDistinctRowCount, getDistinctRowCount, getDistinctRowCount, getDistinctRowCount, getDistinctRowCount, getDistinctRowCount, getDistinctRowCount
-
Field Details
-
SOURCE
public static final org.apache.calcite.rel.metadata.RelMetadataProvider SOURCE
-
-
Constructor Details
-
DrillRelMdDistinctRowCount
public DrillRelMdDistinctRowCount()
-
-
Method Details
-
getDistinctRowCount
public Double getDistinctRowCount(org.apache.calcite.rel.core.Join rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.util.ImmutableBitSet groupKey, org.apache.calcite.rex.RexNode predicate) We need to override this method since Calcite and Drill calculate joined row count in different ways. It helps avoid a case when at the first time was used Drill join row count but at the second time Calcite row count was used. It may happen whenRelMdDistinctRowCount.getDistinctRowCount(Join, RelMetadataQuery, ImmutableBitSet, RexNode)
method is used and after that used another getDistinctRowCount method for parent rel, which just uses row count of input rel node (our join rel). It causes cost increase of best rel node whenRelSubset#propagateCostImprovements
is called. This is a part of the fix for CALCITE-2018.- Overrides:
getDistinctRowCount
in classorg.apache.calcite.rel.metadata.RelMdDistinctRowCount
-
getDistinctRowCount
public Double getDistinctRowCount(org.apache.calcite.rel.RelNode rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.util.ImmutableBitSet groupKey, org.apache.calcite.rex.RexNode predicate) - Overrides:
getDistinctRowCount
in classorg.apache.calcite.rel.metadata.RelMdDistinctRowCount
-
getDistinctRowCount
public Double getDistinctRowCount(org.apache.calcite.plan.volcano.RelSubset rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.util.ImmutableBitSet groupKey, org.apache.calcite.rex.RexNode predicate) - Overrides:
getDistinctRowCount
in classorg.apache.calcite.rel.metadata.RelMdDistinctRowCount
-