use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet in project drill by axbaretto.
the class DrillAggregateRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalAggregate aggregate = call.rel(0);
final RelNode input = call.rel(1);
if (aggregate.containsDistinctCall()) {
// currently, don't use this rule if any of the aggregates contains DISTINCT
return;
}
final RelTraitSet traits = aggregate.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());
try {
call.transformTo(new DrillAggregateRel(aggregate.getCluster(), traits, convertedInput, aggregate.indicator, aggregate.getGroupSet(), aggregate.getGroupSets(), aggregate.getAggCallList()));
} catch (InvalidRelException e) {
tracer.warn(e.toString());
}
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet in project drill by axbaretto.
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 axbaretto.
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 axbaretto.
the class DrillUnionAllRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalUnion union = call.rel(0);
// This rule applies to Union-All only
if (!union.all) {
return;
}
final RelTraitSet traits = union.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
final List<RelNode> convertedInputs = new ArrayList<>();
for (RelNode input : union.getInputs()) {
final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());
convertedInputs.add(convertedInput);
}
try {
call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all, true));
} catch (InvalidRelException e) {
tracer.warn(e.toString());
}
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet in project drill by axbaretto.
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));
}
Aggregations