xiedeyantu commented on code in PR #4580:
URL: https://github.com/apache/calcite/pull/4580#discussion_r2440635209
##########
core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java:
##########
@@ -6006,6 +6021,46 @@ RexFieldAccess getFieldAccess(CorrelationId name) {
}
}
+ /**
+ * Shuttle that rewrites correlation field accesses to use projected field
indices
+ * when correlation references aggregated relations.
+ */
+ private static class CorrelationFieldMappingShuttle extends
RelHomogeneousShuttle {
+ private final RexBuilder rexBuilder;
+ private final CorrelationId targetCorrelId;
+ private final RelDataType newCorrelRowType;
+ private final Map<Pair<CorrelationId, Integer>, Integer> fieldMapping;
+
+ CorrelationFieldMappingShuttle(RexBuilder rexBuilder,
+ CorrelationId targetCorrelId,
+ RelDataType newCorrelRowType,
+ Map<Pair<CorrelationId, Integer>, Integer> fieldMapping) {
+ this.rexBuilder = rexBuilder;
+ this.targetCorrelId = targetCorrelId;
+ this.newCorrelRowType = newCorrelRowType;
+ this.fieldMapping = fieldMapping;
+ }
+
+ @Override public RelNode visit(RelNode other) {
Review Comment:
I understand that the Shuttle here can only process RexNode(like
RexSubQuery), and it won't delve deeper into the RelNodelevel. I'm not sure if
that's the issue you were referring to.
--
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]