jduo commented on code in PR #3757:
URL: https://github.com/apache/calcite/pull/3757#discussion_r1573051289


##########
core/src/main/java/org/apache/calcite/tools/RelBuilder.java:
##########
@@ -2502,9 +2502,10 @@ private RelBuilder 
pruneAggregateInputFieldsAndDeduplicateAggCalls(
           newProjects.add(project.getProjects().get(i));
           builder.add(project.getRowType().getFieldList().get(i));
         }
+
         r =
-            project.copy(cluster.traitSet(), project.getInput(), newProjects,
-                builder.build());
+            project.copy(project.getTraitSet().apply(targetMapping), 
project.getInput(),

Review Comment:
   I haven't figured out how to create a test that covers this -- do you know 
of a way to alter collations for nodes created by a RelBuilder?
   
   I'm not entirely sure if using the mapping is necessary. When implementing 
this using the Mapping route vs. copy the traitset, I see a slight difference 
in the interner, but I don't think this would be user-facing:
   
![image](https://github.com/apache/calcite/assets/1657237/f8b955e9-f47b-454e-93e0-d4fd49b1a9c2)
   The order of the entries in the MapMakerInternalMap differs a bit (the 
PRESERVE entry appears earlier).



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