NobiGo commented on code in PR #2811:
URL: https://github.com/apache/calcite/pull/2811#discussion_r1772397412
##########
core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java:
##########
@@ -1958,7 +1959,33 @@ private RelOptUtil.Exists convertExists(
if (!values.getTuples().isEmpty()) {
unionInputs.add(values);
}
- resultRel = LogicalUnion.create(unionInputs, true);
+ RelDataType finalRowType = rowType;
Review Comment:
@mihaibudiu Yes, as you can see, it is the same as UNION_TO_VALUES but
works in different phases. One is the convert SQL to RelNode phase, and the
other is the optimize phase.
Before this PR. When we convert the SQL to RelNode(convert IN list to Join):
```
SELECT empno FROM emp AS e WHERE cast(e.empno as bigint) in (130, 131, 132,
133, 134)
```
The generated RelNode contains:
```
LogicalAggregate(group=[{0}])
LogicalValues(tuples=[[{ 130 }, { 131 }, { 132 }, { 133 }, { 134 }]])
```
But when we add CAST in the IN list value:
The generated RelNode will be:
```
LogicalUnion(all=[true])
LogicalValues(tuples=[[{ 130 }]])
LogicalValues(tuples=[[{ 131 }]])
LogicalValues(tuples=[[{ 132 }]])
LogicalValues(tuples=[[{ 133 }]])
LogicalValues(tuples=[[{ 134 }]])
```
I want to keep this unchanged, so add the same processing method here.
The unit tests in `SqlToRelConverterTest#testInToSemiJoin`.
--
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]