use of org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillProjectRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final Project 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));
call.transformTo(new DrillProjectRel(project.getCluster(), traits, convertedInput, project.getProjects(), project.getRowType()));
}
use of org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillValuesRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalValues values = (LogicalValues) call.rel(0);
final RelTraitSet traits = values.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
call.transformTo(new DrillValuesRel(values.getCluster(), values.getRowType(), values.getTuples(), traits));
}
use of org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillWindowRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final Window window = call.rel(0);
final RelNode input = call.rel(1);
final RelTraitSet traits = window.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
final RelNode convertedInput = convert(input, traits);
call.transformTo(new DrillWindowRel(window.getCluster(), traits, convertedInput, window.constants, window.getRowType(), window.groups));
}
use of 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));
call.transformTo(new DrillSortRel(sort.getCluster(), traits, convertedInput, sort.getCollation()));
}
use of org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillUnionAllRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalUnion union = (LogicalUnion) 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));
convertedInputs.add(convertedInput);
}
try {
call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all, true));
} catch (InvalidRelException e) {
tracer.warning(e.toString());
}
}
Aggregations