uros-db commented on code in PR #46404:
URL: https://github.com/apache/spark/pull/46404#discussion_r1592822930
##########
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"
Review Comment:
```suggestion
val query = s"SELECT mode(collate(i, '${t.collationName}')) FROM t"
```
--
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]