NobiGo commented on code in PR #4714:
URL: https://github.com/apache/calcite/pull/4714#discussion_r2659494130


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -589,14 +573,14 @@ public TrimResult trimFields(
     final List<RexNode> newProjects = new ArrayList<>();
     final RexVisitor<RexNode> shuttle;
 
-    if (!correlationIds.isEmpty()) {
-      assert correlationIds.size() == 1;
+    if (!project.getVariablesSet().isEmpty()) {
       shuttle = new RexPermuteInputsShuttle(inputMapping, newInput) {
         @Override public RexNode visitSubQuery(RexSubQuery subQuery) {
           subQuery = (RexSubQuery) super.visitSubQuery(subQuery);
 
           return 
RelOptUtil.remapCorrelatesInSuqQuery(relBuilder.getRexBuilder(),
-            subQuery, correlationIds.iterator().next(), newInput.getRowType(), 
inputMapping);
+            subQuery, project.getVariablesSet().iterator().next(),

Review Comment:
   CALCITE-7354 will re-validate this parameter during the Project creation 
process.



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