jduo commented on code in PR #3757:
URL: https://github.com/apache/calcite/pull/3757#discussion_r1577001398
##########
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:
@asolimando , what I've found now:
1. There doesn't appear to be a way to add a RelDistribution trait to the
builder and have it apply to the projection. Adding a RelDistribution trait
using builder.exchange() adds a LogicalExchange node on in between the mapped
projections so the pruning block doesn't get triggered.
2. It is possible to use builder.sort() to add a RelCollation trait to the
projection before the mapping. However the RelCollation is stored in a
RelCompositeTrait, and that composite trait does not override apply(Mapping),
it just uses the default implementation which is the identity mapping. This
seems off though -- I don't get why it doesn't propagate to wrapped traits. I
don't have enough background to tell if this is intentional or a bug. What are
your thoughts here?
--
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]