use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Join in project drill by apache.
the class PluginJoinRule method convert.
@Override
public RelNode convert(RelNode rel) {
Join join = (Join) rel;
RelTraitSet traits = join.getTraitSet().replace(getOutConvention());
return new PluginJoinRel(join.getCluster(), traits, convert(join.getLeft(), traits), convert(join.getRight(), traits), join.getCondition(), join.getJoinType());
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Join 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);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Join in project calcite by apache.
the class SqlToRelConverter method createJoin.
protected RelNode createJoin(Blackboard bb, RelNode leftRel, RelNode rightRel, RexNode joinCond, JoinRelType joinType) {
assert joinCond != null;
final CorrelationUse p = getCorrelationUse(bb, rightRel);
if (p != null) {
LogicalCorrelate corr = LogicalCorrelate.create(leftRel, p.r, p.id, p.requiredColumns, SemiJoinType.of(joinType));
if (!joinCond.isAlwaysTrue()) {
final RelFactories.FilterFactory factory = RelFactories.DEFAULT_FILTER_FACTORY;
return factory.createFilter(corr, joinCond);
}
return corr;
}
final Join originalJoin = (Join) RelFactories.DEFAULT_JOIN_FACTORY.createJoin(leftRel, rightRel, joinCond, ImmutableSet.<CorrelationId>of(), joinType, false);
return RelOptUtil.pushDownJoinConditions(originalJoin, relBuilder);
}
Aggregations