zabetak commented on code in PR #4226:
URL: https://github.com/apache/calcite/pull/4226#discussion_r1981243608
##########
core/src/main/java/org/apache/calcite/rex/RexUtil.java:
##########
@@ -2826,6 +2826,21 @@ private CorrelationFinder() {
@Override public Void visitCorrelVariable(RexCorrelVariable var) {
throw Util.FoundOne.NULL;
}
+
+ @Override public Void visitSubQuery(RexSubQuery subQuery) {
+ if (!deep) {
+ return null;
+ }
+
+ for (RexNode operand : subQuery.operands) {
+ operand.accept(this);
+ }
+
+ if (!RelOptUtil.getVariablesUsed(subQuery.rel).isEmpty()) {
+ throw Util.FoundOne.NULL;
Review Comment:
From a quick look it seems that `RelOptUtil.getVariablesUsed` on its own
does exactly what you want. There is no need to call it from here.
In fact, there is also
`org.apache.calcite.plan.RelOptUtil#notContainsCorrelation` which might be
exactly what you are looking for.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]