Search in sources :

Example 6 with DrillDistributionTrait

use of org.apache.drill.exec.planner.physical.DrillDistributionTrait in project drill by apache.

the class AbstractIndexPlanGenerator method createRangeDistRight.

// Range distribute the right side of the join, on row keys using a range partitioning function
protected RelNode createRangeDistRight(final RelNode rightPrel, final RelDataTypeField rightRowKeyField, final DbGroupScan origDbGroupScan) {
    List<DrillDistributionTrait.DistributionField> rangeDistFields = Lists.newArrayList(new DrillDistributionTrait.DistributionField(0));
    FieldReference rangeDistRef = FieldReference.getWithQuotedRef(rightRowKeyField.getName());
    List<FieldReference> rangeDistRefList = Lists.newArrayList();
    rangeDistRefList.add(rangeDistRef);
    final DrillDistributionTrait distRight;
    if (IndexPlanUtils.scanIsPartition(origDbGroupScan)) {
        distRight = new DrillDistributionTrait(DrillDistributionTrait.DistributionType.RANGE_DISTRIBUTED, ImmutableList.copyOf(rangeDistFields), origDbGroupScan.getRangePartitionFunction(rangeDistRefList));
    } else {
        distRight = DrillDistributionTrait.SINGLETON;
    }
    RelTraitSet rightTraits = newTraitSet(distRight).plus(Prel.DRILL_PHYSICAL);
    RelNode convertedRight = Prule.convert(rightPrel, rightTraits);
    return convertedRight;
}
Also used : FieldReference(org.apache.drill.common.expression.FieldReference) RelNode(org.apache.calcite.rel.RelNode) RelTraitSet(org.apache.calcite.plan.RelTraitSet) DrillDistributionTrait(org.apache.drill.exec.planner.physical.DrillDistributionTrait)

Aggregations

RelTraitSet (org.apache.calcite.plan.RelTraitSet)6 DrillDistributionTrait (org.apache.drill.exec.planner.physical.DrillDistributionTrait)6 RelNode (org.apache.calcite.rel.RelNode)4 RelDataType (org.apache.calcite.rel.type.RelDataType)4 ScanPrel (org.apache.drill.exec.planner.physical.ScanPrel)4 RelDataTypeFactory (org.apache.calcite.rel.type.RelDataTypeFactory)3 RelDataTypeField (org.apache.calcite.rel.type.RelDataTypeField)3 RexNode (org.apache.calcite.rex.RexNode)3 SchemaPath (org.apache.drill.common.expression.SchemaPath)3 DbGroupScan (org.apache.drill.exec.physical.base.DbGroupScan)3 FilterPrel (org.apache.drill.exec.planner.physical.FilterPrel)3 ProjectPrel (org.apache.drill.exec.planner.physical.ProjectPrel)3 ArrayList (java.util.ArrayList)2 RelCollation (org.apache.calcite.rel.RelCollation)2 IndexGroupScan (org.apache.drill.exec.physical.base.IndexGroupScan)2 Pair (org.apache.calcite.util.Pair)1 FieldReference (org.apache.drill.common.expression.FieldReference)1 OrderedRel (org.apache.drill.exec.planner.common.OrderedRel)1 FunctionalIndexInfo (org.apache.drill.exec.planner.index.FunctionalIndexInfo)1 IndexDescriptor (org.apache.drill.exec.planner.index.IndexDescriptor)1