Skip to content

Commit

Permalink
[SPARK-48911][SQL][FOLLOWUP][TESTS] Fix test for collect_set
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Fix test for `collect_set`.

### Why are the changes needed?
`collect_set` doesn't guarantee ordering, so we shouldn't assume it in the test.

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

### How was this patch tested?
Updated test.

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

Closes apache#47644 from uros-db/add-tests-followup.

Authored-by: Uros Bojanic <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
  • Loading branch information
uros-db authored and HyukjinKwon committed Aug 7, 2024
1 parent 46acdf4 commit 490f0bc
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2710,12 +2710,9 @@ class CollationSQLExpressionsSuite
val collation = "UNICODE"
val query = s"SELECT collect_set(col) FROM VALUES ('a'), ('b'), ('a') AS tab(col);"
withSQLConf(SqlApiConf.DEFAULT_COLLATION -> collation) {
checkAnswer(
sql(query),
Seq(
Row(Seq("a", "b"))
)
)
val result = sql(query).collect().head.getSeq[String](0).toSet
val expected = Set("a", "b")
assert(result == expected)
// check result row data type
val dataType = ArrayType(StringType(collation), false)
assert(sql(query).schema.head.dataType == dataType)
Expand Down

0 comments on commit 490f0bc

Please sign in to comment.