use of org.apache.calcite.rel.core.Union in project druid by druid-io.
the class DruidUnionRule method onMatch.
@Override
public void onMatch(final RelOptRuleCall call) {
final Union unionRel = call.rel(0);
final DruidRel<?> someDruidRel = call.rel(1);
final List<RelNode> inputs = unionRel.getInputs();
// Can only do UNION ALL.
if (unionRel.all) {
call.transformTo(DruidUnionRel.create(someDruidRel.getPlannerContext(), unionRel.getRowType(), inputs, -1));
} else {
plannerContext.setPlanningError("SQL requires 'UNION' but only 'UNION ALL' is supported.");
}
}
use of org.apache.calcite.rel.core.Union in project druid by druid-io.
the class DruidUnionRule method matches.
@Override
public boolean matches(RelOptRuleCall call) {
// Make DruidUnionRule and DruidUnionDataSourceRule mutually exclusive.
final Union unionRel = call.rel(0);
final DruidRel<?> firstDruidRel = call.rel(1);
final DruidRel<?> secondDruidRel = call.rel(2);
return !DruidUnionDataSourceRule.isCompatible(unionRel, firstDruidRel, secondDruidRel, null);
}
use of org.apache.calcite.rel.core.Union in project drill by apache.
the class PluginConverterRule method matches.
@Override
public boolean matches(RelOptRuleCall call) {
RelNode rel = call.rel(0);
boolean canImplement = false;
// cannot use visitor pattern here, since RelShuttle supports only logical rel implementations
if (rel instanceof Aggregate) {
canImplement = pluginImplementor.canImplement(((Aggregate) rel));
} else if (rel instanceof Filter) {
canImplement = pluginImplementor.canImplement(((Filter) rel));
} else if (rel instanceof DrillLimitRelBase) {
canImplement = pluginImplementor.canImplement(((DrillLimitRelBase) rel));
} else if (rel instanceof Project) {
canImplement = pluginImplementor.canImplement(((Project) rel));
} else if (rel instanceof Sort) {
canImplement = pluginImplementor.canImplement(((Sort) rel));
} else if (rel instanceof Union) {
canImplement = pluginImplementor.canImplement(((Union) rel));
} else if (rel instanceof Join) {
canImplement = pluginImplementor.canImplement(((Join) rel));
}
return canImplement && super.matches(call);
}
Aggregations