zabetak commented on a change in pull request #2623:
URL: https://github.com/apache/calcite/pull/2623#discussion_r761868245
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -4346,7 +4336,21 @@ private void convertSelectList(
relBuilder.push(bb.root())
.projectNamed(exprs, fieldNames, true);
- bb.setRoot(relBuilder.build(), false);
+
+ RelNode project = relBuilder.build();
+
+ final RelNode r;
+ final CorrelationUse p = getCorrelationUse(bb, project);
+ if (p != null) {
+ assert p.r instanceof Project;
+ Project proj = (Project) p.r;
+ r = LogicalProject.create(proj.getInput(), proj.getHints(),
Review comment:
I've seen that this pattern appears in other places in
`SqlToRelConverter` but it is a bit weird that from one hand we are asserting
that the project is an instance of a superclass (`Project`) and on the other
hand we are creating a `LogicalProject`. Can we use the `relbuilder` to create
the new project? Would it be better to rely on `project#copy`?
--
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]