mihaibudiu commented on code in PR #4296:
URL: https://github.com/apache/calcite/pull/4296#discussion_r2036369174


##########
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:
   what does LITERAL_AGG return for an empty set? 



-- 
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]

Reply via email to