NobiGo commented on code in PR #4296:
URL: https://github.com/apache/calcite/pull/4296#discussion_r2036551090
##########
core/src/main/java/org/apache/calcite/plan/RelOptUtil.java:
##########
@@ -729,21 +728,10 @@ public static Exists createExistsPlan(
}
// for IN/NOT IN, it needs to output the fields
- final List<RexNode> exprs = new ArrayList<>();
- if (subQueryType == SubQueryType.IN) {
- for (int i = 0; i < keyCount; i++) {
- exprs.add(rexBuilder.makeInputRef(ret, i));
- }
- }
-
- final int projectedKeyCount = exprs.size();
- exprs.add(rexBuilder.makeLiteral(true));
-
ret = relBuilder.push(ret)
- .project(exprs)
.aggregate(
- relBuilder.groupKey(ImmutableBitSet.range(projectedKeyCount)),
- relBuilder.min(relBuilder.field(projectedKeyCount)))
+ relBuilder.groupKey(relBuilder.fields()),
+ relBuilder.literalAgg(true))
Review Comment:
`select literal_agg(true) from emp where 1=0;`
I make this work in Calcite, and it returns 0 rows.
We usually apply literal_agg with a group by condition.
--
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]