uros-db commented on code in PR #45856:
URL: https://github.com/apache/spark/pull/45856#discussion_r1550947385
##########
sql/core/src/test/scala/org/apache/spark/sql/CollationRegexpExpressionsSuite.scala:
##########
@@ -149,38 +149,40 @@ class CollationRegexpExpressionsSuite extends QueryTest
with SharedSparkSession
test("Support StringSplit string expression with Collation") {
// Supported collations
val checks = Seq(
- CollationTestCase("ABC", "[B]", "UTF8_BINARY", 2)
+ CollationTestCase("ABC", "[B]", "UTF8_BINARY", Seq("A", "C")),
+ CollationTestCase("ABC", "[b]", "UTF8_BINARY", Seq("ABC")),
+ CollationTestCase("ABC", "[b]", "UTF8_BINARY_LCASE", Seq("A", "C")),
+ CollationTestCase("AAA", "[a]", "UTF8_BINARY_LCASE", Seq("", "", "",
"")),
+ CollationTestCase("xAxBxaxbx", "[AB]", "UTF8_BINARY_LCASE", Seq("x",
"x", "x", "x", "x")),
+ CollationTestCase("ABC", "[B]", "UNICODE", Seq("A", "C")),
+ CollationTestCase("ABC", "[b]", "UNICODE", Seq("ABC"))
)
checks.foreach(ct => {
- checkAnswer(sql(s"SELECT size(split(collate('${ct.s1}',
'${ct.collation}')" +
- s",collate('${ct.s2}', '${ct.collation}')))"), Row(ct.expectedResult))
+ checkAnswer(sql(s"SELECT split(collate('${ct.s1}', '${ct.collation}')" +
+ s",collate('${ct.s2}', '${ct.collation}'))"), Row(ct.expectedResult))
})
// Unsupported collations
val fails = Seq(
- CollationTestCase("ABC", "[b]", "UTF8_BINARY_LCASE", 0),
- CollationTestCase("ABC", "[B]", "UNICODE", 2),
- CollationTestCase("ABC", "[b]", "UNICODE_CI", 0)
+ CollationTestFail("ABC", "[b]", "UNICODE_CI")
)
fails.foreach(ct => {
checkError(
exception = intercept[ExtendedAnalysisException] {
- sql(s"SELECT size(split(collate('${ct.s1}', '${ct.collation}')" +
- s",collate('${ct.s2}', '${ct.collation}')))")
+ sql(s"SELECT split(collate('${ct.s1}', '${ct.collation}')" +
+ s",collate('${ct.s2}', '${ct.collation}'))")
},
- errorClass = "DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE",
Review Comment:
moving over to `StringTypeCollated`, you'll need to update these tests as
well
--
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]