silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2633264472


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Perhaps we should retain the original logic. `correlationIds` might contain 
free variables that don't belong to the current scope. 
   
   From the test cases below, it's indeed observed that this change corrects 
the issue of some nodes having missing variablesSet. However, the problem of 
missing variablesSet doesn't originate from RelFieldTrimmer; in my observation, 
it's usually caused by manually constructed plans. If RelNode is converted from 
SqlNode using SqlToRelConverter, this problem doesn't occur.



-- 
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]

Reply via email to