mihaibudiu commented on code in PR #3817:
URL: https://github.com/apache/calcite/pull/3817#discussion_r1640155876
##########
core/src/main/java/org/apache/calcite/util/RelToSqlConverterUtil.java:
##########
@@ -93,6 +101,41 @@ public static void unparseSparkArrayAndMap(SqlWriter writer,
writer.endList(frame);
}
+
+ /**
+ * Rewrite SINGLE_VALUE use SparkSQL Mode.
+ *
+ * <blockquote><pre>
+ * CASE COUNT(*)
+ * WHEN 0 THEN NULL
+ * WHEN 1 THEN MIN(<result>)
+ * ELSE (SELECT NULL UNION ALL SELECT NULL))
Review Comment:
You should add a comment in the code about the UNION ALL. Your intent is not
obvious at all.
I am not sure how the runtime error will look; if the error will mention a
UNION ALL operator, the users may be confused, since there is no UNION ALL in
the original query, but I guess there isn't much you can do about this.
--
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]