use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillScanRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final EnumerableTableScan access = call.rel(0);
final RelTraitSet traits = access.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
call.transformTo(new DrillScanRel(access.getCluster(), traits, access.getTable()));
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillSortRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final Sort sort = call.rel(0);
final RelNode input = sort.getInput();
final RelTraitSet traits = sort.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());
call.transformTo(new DrillSortRel(sort.getCluster(), traits, convertedInput, sort.getCollation()));
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillLimitRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final Sort incomingSort = call.rel(0);
final RelTraitSet incomingTraits = incomingSort.getTraitSet();
RelNode input = incomingSort.getInput();
// limit information.
if (!incomingSort.getCollation().getFieldCollations().isEmpty()) {
input = incomingSort.copy(incomingTraits, input, incomingSort.getCollation(), null, null);
}
RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());
call.transformTo(new DrillLimitRel(incomingSort.getCluster(), convertedInput.getTraitSet().plus(DrillRel.DRILL_LOGICAL), convertedInput, incomingSort.offset, incomingSort.fetch));
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillProjectPushIntoLateralJoinRule method onMatch.
public void onMatch(RelOptRuleCall call) {
DrillProjectRel origProj = call.rel(0);
final DrillLateralJoinRel corr = call.rel(1);
if (StarColumnHelper.containsStarColumn(origProj.getRowType()) || StarColumnHelper.containsStarColumn(corr.getRowType()) || corr.excludeCorrelateColumn) {
return;
}
DrillRelOptUtil.InputRefVisitor collectRefs = new DrillRelOptUtil.InputRefVisitor();
for (RexNode exp : origProj.getChildExps()) {
exp.accept(collectRefs);
}
int correlationIndex = corr.getRequiredColumns().nextSetBit(0);
for (RexInputRef inputRef : collectRefs.getInputRefs()) {
if (inputRef.getIndex() == correlationIndex) {
return;
}
}
final RelNode left = corr.getLeft();
final RelNode right = corr.getRight();
final RelNode convertedLeft = convert(left, left.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());
final RelNode convertedRight = convert(right, right.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());
final RelTraitSet traits = corr.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
boolean trivial = DrillRelOptUtil.isTrivialProject(origProj, true);
RelNode relNode = new DrillLateralJoinRel(corr.getCluster(), traits, convertedLeft, convertedRight, true, corr.getCorrelationId(), corr.getRequiredColumns(), corr.getJoinType());
if (!trivial) {
Map<Integer, Integer> mapWithoutCorr = buildMapWithoutCorrColumn(corr, correlationIndex);
List<RexNode> outputExprs = DrillRelOptUtil.transformExprs(origProj.getCluster().getRexBuilder(), origProj.getChildExps(), mapWithoutCorr);
relNode = new DrillProjectRel(origProj.getCluster(), left.getTraitSet().plus(DrillRel.DRILL_LOGICAL), relNode, outputExprs, origProj.getRowType());
}
call.transformTo(relNode);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillProjectRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final Project project = call.rel(0);
final RelNode input = project.getInput();
final RelTraitSet traits = project.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());
call.transformTo(new DrillProjectRel(project.getCluster(), traits, convertedInput, project.getProjects(), project.getRowType()));
}
Aggregations