Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the test becomes flaky? Reading the test query I think both aaa and AAA are correct result. cc @stefankandic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it becomes flaky. The returned value is not non-deterministic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean just non-deterministic, I guess.

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