amaliujia commented on code in PR #37750:
URL: https://github.com/apache/spark/pull/37750#discussion_r960149145
##########
sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala:
##########
@@ -4473,6 +4473,16 @@ class SQLQuerySuite extends QueryTest with
SharedSparkSession with AdaptiveSpark
sql("select * from test_temp_view"),
Row(1, 2, 3, 1, 2, 3, 1, 1))
}
+
+ test("SPARK-40296: DISTINCT function not found") {
+ val e = intercept[AnalysisException] {
+ sql(
+ """
+ |SELECT SUM(c1), DISTINCT(c1, c2) FROM VALUES(1, 2), (2, 2), (1, 2)
AS T(c1, c2);
+ |""".stripMargin)
+ }
+ assert(e.message.contains("The function `DISTINCT` does not exist in the
current schema"))
Review Comment:
The full output message is
```
[DISTINCT_FUNCTION_NOT_FOUND] The function `DISTINCT` does not exist in the
current schema spark_catalog.default. To deduplicate columns use SELECT
DISTINCT ArrayBuffer('c1, 'c2) … . Otherwise, verify the function name or
qualify the function name with its schema.
```
##########
sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala:
##########
@@ -4473,6 +4473,16 @@ class SQLQuerySuite extends QueryTest with
SharedSparkSession with AdaptiveSpark
sql("select * from test_temp_view"),
Row(1, 2, 3, 1, 2, 3, 1, 1))
}
+
+ test("SPARK-40296: DISTINCT function not found") {
+ val e = intercept[AnalysisException] {
+ sql(
+ """
+ |SELECT SUM(c1), DISTINCT(c1, c2) FROM VALUES(1, 2), (2, 2), (1, 2)
AS T(c1, c2);
+ |""".stripMargin)
+ }
+ assert(e.message.contains("The function `DISTINCT` does not exist in the
current schema"))
Review Comment:
The full output message is
[DISTINCT_FUNCTION_NOT_FOUND] The function `DISTINCT` does not exist in the
current schema spark_catalog.default. To deduplicate columns use SELECT
DISTINCT ArrayBuffer('c1, 'c2) … . Otherwise, verify the function name or
qualify the function name with its schema.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]