Java Code Examples for org.apache.calcite.rel.logical.LogicalCorrelate#getCorrelationId()

The following examples show how to use org.apache.calcite.rel.logical.LogicalCorrelate#getCorrelationId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RelDecorrelator.java    From Bats with Apache License 2.0 6 votes vote down vote up
private Function2<RelNode, RelNode, Void> createCopyHook() {
    return (oldNode, newNode) -> {
        if (cm.mapRefRelToCorRef.containsKey(oldNode)) {
            cm.mapRefRelToCorRef.putAll(newNode, cm.mapRefRelToCorRef.get(oldNode));
        }
        if (oldNode instanceof LogicalCorrelate && newNode instanceof LogicalCorrelate) {
            LogicalCorrelate oldCor = (LogicalCorrelate) oldNode;
            CorrelationId c = oldCor.getCorrelationId();
            if (cm.mapCorToCorRel.get(c) == oldNode) {
                cm.mapCorToCorRel.put(c, newNode);
            }

            if (generatedCorRels.contains(oldNode)) {
                generatedCorRels.add((LogicalCorrelate) newNode);
            }
        }
        return null;
    };
}
 
Example 2
Source File: RelDecorrelator.java    From flink with Apache License 2.0 6 votes vote down vote up
private Function2<RelNode, RelNode, Void> createCopyHook() {
  return (oldNode, newNode) -> {
    if (cm.mapRefRelToCorRef.containsKey(oldNode)) {
      cm.mapRefRelToCorRef.putAll(newNode,
          cm.mapRefRelToCorRef.get(oldNode));
    }
    if (oldNode instanceof LogicalCorrelate
        && newNode instanceof LogicalCorrelate) {
      LogicalCorrelate oldCor = (LogicalCorrelate) oldNode;
      CorrelationId c = oldCor.getCorrelationId();
      if (cm.mapCorToCorRel.get(c) == oldNode) {
        cm.mapCorToCorRel.put(c, newNode);
      }

      if (generatedCorRels.contains(oldNode)) {
        generatedCorRels.add((LogicalCorrelate) newNode);
      }
    }
    return null;
  };
}
 
Example 3
Source File: RelDecorrelator.java    From flink with Apache License 2.0 6 votes vote down vote up
private Function2<RelNode, RelNode, Void> createCopyHook() {
  return (oldNode, newNode) -> {
    if (cm.mapRefRelToCorRef.containsKey(oldNode)) {
      cm.mapRefRelToCorRef.putAll(newNode,
          cm.mapRefRelToCorRef.get(oldNode));
    }
    if (oldNode instanceof LogicalCorrelate
        && newNode instanceof LogicalCorrelate) {
      LogicalCorrelate oldCor = (LogicalCorrelate) oldNode;
      CorrelationId c = oldCor.getCorrelationId();
      if (cm.mapCorToCorRel.get(c) == oldNode) {
        cm.mapCorToCorRel.put(c, newNode);
      }

      if (generatedCorRels.contains(oldNode)) {
        generatedCorRels.add((LogicalCorrelate) newNode);
      }
    }
    return null;
  };
}
 
Example 4
Source File: DrillCorrelateRule.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalCorrelate correlate = call.rel(0);
  final RelNode left = correlate.getLeft();
  final RelNode right = correlate.getRight();
  final RelNode convertedLeft = convert(left, left.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());
  final RelNode convertedRight = convert(right, right.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify());

  final RelTraitSet traits = correlate.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
  DrillLateralJoinRel lateralJoinRel = new DrillLateralJoinRel(correlate.getCluster(),
      traits, convertedLeft, convertedRight, false, correlate.getCorrelationId(),
      correlate.getRequiredColumns(), correlate.getJoinType());
  call.transformTo(lateralJoinRel);
}
 
Example 5
Source File: CopyWithCluster.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public RelNode visit(LogicalCorrelate correlate) {
  final RelNode left = correlate.getLeft().accept(this);
  final RelNode right = correlate.getRight().accept(this);

  return new LogicalCorrelate(
    cluster,
    copyOf(correlate.getTraitSet()),
    left,
    right,
    correlate.getCorrelationId(),
    correlate.getRequiredColumns(),
    correlate.getJoinType()
  );
}
 
Example 6
Source File: CorrelateRule.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalCorrelate correlate = call.rel(0);
  final RelTraitSet traits = correlate.getTraitSet().plus(Rel.LOGICAL);
  final RelNode left = correlate.getInput(0);
  final RelNode right = correlate.getInput(1);
  final RelNode convertedLeftInput = convert(left, left.getTraitSet().plus(Rel.LOGICAL).simplify());
  final RelNode convertedRightInput = convert(right, right.getTraitSet().plus(Rel.LOGICAL).simplify());
  CorrelateRel newRel = new CorrelateRel(correlate.getCluster(), traits, convertedLeftInput,
          convertedRightInput, correlate.getCorrelationId(), correlate.getRequiredColumns(), correlate.getJoinType());
  call.transformTo(newRel);
}