uros-db commented on code in PR #47372:
URL: https://github.com/apache/spark/pull/47372#discussion_r1701789525


##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSQLExpressionsSuite.scala:
##########
@@ -2295,6 +2295,827 @@ class CollationSQLExpressionsSuite
     assert(typeException.getErrorClass === 
"DATATYPE_MISMATCH.UNEXPECTED_STATIC_METHOD")
   }
 
+  test("min_by supports collation") {
+    val collation = "UNICODE"
+    val query = s"SELECT min_by(x, y) FROM VALUES ('a', 10), ('b', 50), ('c', 
20) AS tab(x, y);"
+    withSQLConf(SqlApiConf.DEFAULT_COLLATION -> collation) {
+      checkAnswer(
+        sql(query),
+        Seq(
+          Row("a")
+        )
+      )
+      // check result row data type
+      val dataType = StringType(collation)
+      assert(sql(query).schema.head.dataType == dataType)
+    }
+  }
+
+  test("max_by supports collation") {
+    val collation = "UNICODE"
+    val query = s"SELECT max_by(x, y) FROM VALUES ('a', 10), ('b', 50), ('c', 
20) AS tab(x, y);"
+    withSQLConf(SqlApiConf.DEFAULT_COLLATION -> collation) {
+      checkAnswer(
+        sql(query),
+        Seq(
+          Row("b")
+        )
+      )
+      // check result row data type
+      val dataType = StringType(collation)
+      assert(sql(query).schema.head.dataType == dataType)
+    }
+  }
+
+  test("array supports collation") {

Review Comment:
   update: consulted with @mihailom-db to conclude that this is actually proper 
and expected behaviour according to the SQL standard, because complex type 
extraction is treated as implicit



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

Reply via email to