use of org.apache.calcite.rel.logical.LogicalCorrelate in project flink by apache.
the class FlinkRelDecorrelator method createCopyHook.
private Function2<RelNode, RelNode, Void> createCopyHook() {
return new Function2<RelNode, RelNode, Void>() {
public Void apply(RelNode oldNode, RelNode newNode) {
if (cm.mapRefRelToCorVar.containsKey(oldNode)) {
cm.mapRefRelToCorVar.putAll(newNode, cm.mapRefRelToCorVar.get(oldNode));
}
if (oldNode instanceof LogicalCorrelate && newNode instanceof LogicalCorrelate) {
LogicalCorrelate oldCor = (LogicalCorrelate) oldNode;
CorrelationId c = oldCor.getCorrelationId();
if (cm.mapCorVarToCorRel.get(c) == oldNode) {
cm.mapCorVarToCorRel.put(c, newNode);
}
if (generatedCorRels.contains(oldNode)) {
generatedCorRels.add((LogicalCorrelate) newNode);
}
}
return null;
}
};
}
use of org.apache.calcite.rel.logical.LogicalCorrelate in project hive by apache.
the class HiveRelDecorrelator method createCopyHook.
private Function2<RelNode, RelNode, Void> createCopyHook() {
return new Function2<RelNode, RelNode, Void>() {
public Void apply(RelNode oldNode, RelNode newNode) {
if (cm.mapRefRelToCorRef.containsKey(oldNode)) {
final CorelMap corelMap = new CorelMapBuilder().build(newNode);
// to figure out new cor refs and put that into map
if (!corelMap.mapRefRelToCorRef.isEmpty()) {
cm.mapRefRelToCorRef.putAll(newNode, corelMap.mapRefRelToCorRef.get(newNode));
}
}
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;
}
};
}
Aggregations