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


##########
sql/core/src/test/scala/org/apache/spark/sql/CollationStringExpressionsSuite.scala:
##########
@@ -800,6 +804,61 @@ class CollationStringExpressionsSuite
     assert(collationMismatch.getErrorClass === "COLLATION_MISMATCH.EXPLICIT")
   }
 
+  test("Support mode for string expression with collation") {
+    val query = "SELECT mode(collate('abc', 'utf8_binary'))"
+    checkAnswer(sql(query), Row("abc"))
+    
assert(sql(query).schema.fields.head.dataType.sameType(StringType("utf8_binary")))
+  }
+
+  test("Support mode for string expression with collation ID on table") {
+    withTable("t") {
+      sql("CREATE TABLE t(i STRING) USING parquet")
+      sql("INSERT INTO t VALUES " +
+        "('a'), ('a'), ('a'), ('a'), ('a'), " +
+        "('b'), ('b'), ('b'), " +
+        "('B'), ('B'), ('B'), ('B')")
+      val query = "SELECT mode(collate(i, 'UTF8_BINARY_LCASE')) FROM t"
+      checkAnswer(sql(query), Row("b"))
+    }
+  }

Review Comment:
   here would be a good idea to test multiple collation types, which are 
expected to return different results
   
   consider using something like: `Seq("UTF8_BINARY_LCASE", "UNICODE", 
"UNICODE_CI").foreach(collationName =>`



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to