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


##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSuite.scala:
##########
@@ -564,6 +564,31 @@ class CollationSuite extends DatasourceV2SQLBase with 
AdaptiveSparkPlanHelper {
 
       checkAnswer(sql("SELECT array_join(array('a', 'b' collate UNICODE), 'c' 
collate UNICODE_CI)"),
         Seq(Row("acb")))
+
+      // overlay
+      checkAnswer(sql(
+        s"""
+           |SELECT typeof(overlay('hello' collate UTF8_BINARY_LCASE PLACING ' 
world' FROM 5))
+           |""".stripMargin), Seq(Row("string collate UTF8_BINARY_LCASE")))
+      checkAnswer(sql(
+        s"""
+           |SELECT typeof(overlay('hello' PLACING ' world' collate UNICODE 
FROM 5))
+           |""".stripMargin), Seq(Row("string collate UNICODE")))
+      checkError(
+        exception = intercept[AnalysisException] {
+          sql("SELECT overlay('a' collate UNICODE PLACING 'b' collate 
UNICODE_CI FROM 1)")
+        },
+        errorClass = "COLLATION_MISMATCH.EXPLICIT",
+        parameters = Map(
+          "explicitTypes" -> "`string collate UNICODE`.`string collate 
UNICODE_CI`"
+        )
+      )
+      checkError(
+        exception = intercept[AnalysisException] {
+          sql(s"SELECT overlay(c1 PLACING c2 FROM 1) FROM $tableName ")
+        },
+        errorClass = "COLLATION_MISMATCH.IMPLICIT"
+      )

Review Comment:
   see: `test("Support Contains string expression with collation")`
   // Collation mismatch



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