Skip to content

Commit

Permalink
[SPARK-49498][SQL][TESTS] Check differences between SR_AI and SR_Latn…
Browse files Browse the repository at this point in the history
…_AI collations

### What changes were proposed in this pull request?
Added test to check difference between SR_AI and SR_Latn_AI collations.

### Why are the changes needed?
Better testing.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Test added to `CollationSuite.scala`

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #47958 from ilicmarkodb/add_test_for_difference_between_SR_AI_and_SR_Latn_AI_collations.

Authored-by: Marko <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
  • Loading branch information
ilicmarkodb authored and MaxGekk committed Sep 17, 2024
1 parent dd8d127 commit f586ffb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions sql/core/src/test/scala/org/apache/spark/sql/CollationSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,29 @@ class CollationSuite extends DatasourceV2SQLBase with AdaptiveSparkPlanHelper {
}
}

test("check difference betweeen SR_AI and SR_Latn_AI collations") {
// scalastyle:off nonascii
Seq(
("c", "ć"),
("c", "č"),
("ć", "č"),
("C", "Ć"),
("C", "Č"),
("Ć", "Č"),
("s", "š"),
("S", "Š"),
("z", "ž"),
("Z", "Ž")
).foreach {
case (c1, c2) =>
// SR_Latn_AI
checkAnswer(sql(s"SELECT '$c1' = '$c2' COLLATE SR_Latn_AI"), Row(false))
// SR_AI
checkAnswer(sql(s"SELECT '$c1' = '$c2' COLLATE SR_AI"), Row(true))
}
// scalastyle:on nonascii
}

test("equality check respects collation") {
Seq(
("utf8_binary", "aaa", "AAA", false),
Expand Down

0 comments on commit f586ffb

Please sign in to comment.