Skip to content

Commit

Permalink
[SPARK-49246][SQL][TESTS][FOLLOWUP] Fix flaky CollationSuite
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
The pr is following up apache#48019.

### Why are the changes needed?
Fix flaky `CollationSuite `.
After this PR, GA's `CollationSuite` failed, let's fix it first.
https://github.com/panbingkun/spark/actions/runs/10765984604/job/29851047311
<img width="997" alt="image" src="https://github.com/user-attachments/assets/49667aea-a960-48f3-b2fc-eb0d87773870">

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

### How was this patch tested?
Update existed UT.

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

Closes apache#48031 from panbingkun/SPARK-49246_FOLLOWUP.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
  • Loading branch information
panbingkun authored and cloud-fan committed Sep 9, 2024
1 parent 8bc26d0 commit 20643bb
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,10 @@ class CollationSuite extends DatasourceV2SQLBase with AdaptiveSparkPlanHelper {
withTable(table) {
sql(s"create table $table (a array<string collate utf8_lcase>) using parquet")
sql(s"insert into $table values (array('aaa')), (array('AAA'))")
checkAnswer(sql(s"select distinct a from $table"), Seq(Row(Seq("aaa"))))
val result = sql(s"select distinct a from $table").collect()
assert(result.length === 1)
val data = result.head.getSeq[String](0)
assert(data === Array("aaa") || data === Array("AAA"))
}
// map doesn't support aggregation
withTable(table) {
Expand All @@ -968,7 +971,10 @@ class CollationSuite extends DatasourceV2SQLBase with AdaptiveSparkPlanHelper {
withTable(table) {
sql(s"create table $table (s struct<fld:string collate utf8_lcase>) using parquet")
sql(s"insert into $table values (named_struct('fld', 'aaa')), (named_struct('fld', 'AAA'))")
checkAnswer(sql(s"select s.fld from $table group by s"), Seq(Row("aaa")))
val result = sql(s"select s.fld from $table group by s").collect()
assert(result.length === 1)
val data = result.head.getString(0)
assert(data === "aaa" || data === "AAA")
}
}

Expand Down

0 comments on commit 20643bb

Please sign in to comment.