uros-db commented on code in PR #46404: URL: https://github.com/apache/spark/pull/46404#discussion_r1592825050
########## 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")) + } + } + + test("Support mode for string expression with collation ID") { + val query = "SELECT mode(collate('lorem epsum', 'UTF8_BINARY_LCASE'))" + checkAnswer(sql(query), Row("lorem epsum")) + assert(sql(query).schema.fields.head.dataType.sameType(StringType("UTF8_BINARY_LCASE"))) Review Comment: dataType check can be incorporated into the previous test, so this test can then be removed -- 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