use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Join in project calcite by apache.
the class SemiJoinRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final Join join = call.rel(0);
final RelNode left = call.rel(1);
final Aggregate aggregate = call.rel(2);
perform(call, null, join, left, aggregate);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Join in project drill by axbaretto.
the class JoinUtils method checkCartesianJoin.
/**
* Check if the given RelNode contains any Cartesian join.
* Return true if find one. Otherwise, return false.
*
* @param relNode the RelNode to be inspected.
* @param leftKeys a list used for the left input into the join which has
* equi-join keys. It can be empty or not (but not null),
* this method will clear this list before using it.
* @param rightKeys a list used for the right input into the join which has
* equi-join keys. It can be empty or not (but not null),
* this method will clear this list before using it.
* @param filterNulls The join key positions for which null values will not
* match.
* @return Return true if the given relNode contains Cartesian join.
* Otherwise, return false
*/
public static boolean checkCartesianJoin(RelNode relNode, List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls) {
if (relNode instanceof Join) {
leftKeys.clear();
rightKeys.clear();
Join joinRel = (Join) relNode;
RelNode left = joinRel.getLeft();
RelNode right = joinRel.getRight();
RexNode remaining = RelOptUtil.splitJoinCondition(left, right, joinRel.getCondition(), leftKeys, rightKeys, filterNulls);
if (joinRel.getJoinType() == JoinRelType.INNER) {
if (leftKeys.isEmpty() || rightKeys.isEmpty()) {
return true;
}
} else {
if (!remaining.isAlwaysTrue() || leftKeys.isEmpty() || rightKeys.isEmpty()) {
return true;
}
}
}
for (RelNode child : relNode.getInputs()) {
if (checkCartesianJoin(child, leftKeys, rightKeys, filterNulls)) {
return true;
}
}
return false;
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Join in project drill by apache.
the class JoinUtils method checkCartesianJoin.
/**
* Check if the given RelNode contains any Cartesian join.
* Return true if find one. Otherwise, return false.
*
* @param relNode the RelNode to be inspected.
* @param leftKeys a list used for the left input into the join which has
* equi-join keys. It can be empty or not (but not null),
* this method will clear this list before using it.
* @param rightKeys a list used for the right input into the join which has
* equi-join keys. It can be empty or not (but not null),
* this method will clear this list before using it.
* @param filterNulls The join key positions for which null values will not
* match.
* @return Return true if the given relNode contains Cartesian join.
* Otherwise, return false
*/
public static boolean checkCartesianJoin(RelNode relNode, List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls) {
if (relNode instanceof Join) {
leftKeys.clear();
rightKeys.clear();
Join joinRel = (Join) relNode;
RelNode left = joinRel.getLeft();
RelNode right = joinRel.getRight();
RexNode remaining = RelOptUtil.splitJoinCondition(left, right, joinRel.getCondition(), leftKeys, rightKeys, filterNulls);
if (joinRel.getJoinType() == JoinRelType.INNER) {
if (leftKeys.isEmpty() || rightKeys.isEmpty()) {
return true;
}
} else {
if (!remaining.isAlwaysTrue() || leftKeys.isEmpty() || rightKeys.isEmpty()) {
return true;
}
}
}
for (RelNode child : relNode.getInputs()) {
if (checkCartesianJoin(child, leftKeys, rightKeys, filterNulls)) {
return true;
}
}
return false;
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Join in project drill by apache.
the class PhoenixJoinRule method convert.
@Override
public RelNode convert(RelNode rel) {
final List<RelNode> newInputs = new ArrayList<>();
final Join join = (Join) rel;
for (RelNode input : join.getInputs()) {
if (input.getConvention() != getOutTrait()) {
input = convert(input, input.getTraitSet().replace(out));
}
newInputs.add(input);
}
try {
JdbcJoin jdbcJoin = new JdbcJoin(join.getCluster(), join.getTraitSet().replace(out), newInputs.get(0), newInputs.get(1), join.getCondition(), join.getVariablesSet(), join.getJoinType());
return jdbcJoin;
} catch (InvalidRelException e) {
return null;
}
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Join in project flink by apache.
the class FlinkAggregateJoinTransposeRule method matches.
@Override
public boolean matches(RelOptRuleCall call) {
// avoid push aggregates through dim join
Join join = call.rel(1);
RelNode right = join.getRight();
// right tree should not contain temporal table
return !containsSnapshot(right);
}
Aggregations