NobiGo commented on code in PR #3817:
URL: https://github.com/apache/calcite/pull/3817#discussion_r1639121901
##########
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:
> 1. SELECT NULL UNION ALL SELECT NULL
this is intentional to make sure when the subquery include more then one
value ,This SQL will throw exception.
2: Suggestion: Use COUNT(field) instead of COUNT(*)
Please check CALCITE-6430.
--
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]