asolimando commented on a change in pull request #2454:
URL: https://github.com/apache/calcite/pull/2454#discussion_r804554756
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -4651,7 +4651,12 @@ public RexNode register(
currentProjection);
}
- setRoot(newLeftInput, false);
+ // keep leaves property.
Review comment:
I don't really understand the comment, can you please elaborate more on
that? I think a good explanation of what you are trying to do here is very much
needed (i.e., why are we replacing the root in this specific case?).
##########
File path: core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
##########
@@ -3611,6 +3611,20 @@ void checkCorrelatedMapSubQuery(boolean expand) {
.convertsTo("${planConverted}");
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-4683">[CALCITE-4683]
+ * In-list to join causes field datatypes not matched</a>. */
+ @Test void testInToSemiJoinWithNewProject() {
+ // Before this bug fixed, converting the sql to rel will fail.
Review comment:
I'd rather drop this comment here and add the stack trace of the error
in the description of the Jira ticket, it will help people understand if they
are hitting the same bug as you.
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -4651,7 +4651,12 @@ public RexNode register(
currentProjection);
}
- setRoot(newLeftInput, false);
+ // keep leaves property.
+ if (leaves.remove(root()) != null) {
+ setRoot(newLeftInput, true);
+ } else {
+ setRoot(newLeftInput, false);
+ }
Review comment:
What about compacting into this equivalent version?
```suggestion
setRoot(newLeftInput, leaves.remove(root()) != null);
```
--
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]