use of org.apache.calcite.rex.RexSubQuery in project flink by apache.
the class SubQueryDecorrelator method handleSubQuery.
private RexVisitorImpl<Void> handleSubQuery(final RelNode rel) {
return new RexVisitorImpl<Void>(true) {
@Override
public Void visitSubQuery(RexSubQuery subQuery) {
RelNode newRel = subQuery.rel;
if (subQuery.getKind() == SqlKind.IN) {
newRel = addProjectionForIn(subQuery.rel);
}
final Frame frame = decorrelator.getInvoke(newRel);
if (frame != null && frame.c != null) {
Frame target = frame;
if (subQuery.getKind() == SqlKind.EXISTS) {
target = addProjectionForExists(frame);
}
final DecorrelateRexShuttle shuttle = new DecorrelateRexShuttle(rel.getRowType(), target.r.getRowType(), rel.getVariablesSet());
final RexNode newCondition = target.c.accept(shuttle);
Pair<RelNode, RexNode> newNodeAndCondition = new Pair<>(target.r, newCondition);
subQueryMap.put(subQuery, newNodeAndCondition);
}
return null;
}
};
}
Aggregations