cloud-fan commented on code in PR #48412:
URL: https://github.com/apache/spark/pull/48412#discussion_r1795476158
##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSuite.scala:
##########
@@ -1101,6 +1101,259 @@ class CollationSuite extends DatasourceV2SQLBase with
AdaptiveSparkPlanHelper {
}
}
+ test("Check order by on table with collated string column") {
+ val tableName = "t"
+ Seq(
+ // (collationName, data, expResult)
+ (
+ "", // non-collated
+ Seq((5, "bbb"), (3, "a"), (1, "A"), (4, "aaaa"), (6, "cc"), (2,
"BbB")),
+ Seq(1, 2, 3, 4, 5, 6)
+ ),
+ (
+ "UTF8_BINARY",
+ Seq((5, "bbb"), (3, "a"), (1, "A"), (4, "aaaa"), (6, "cc"), (2,
"BbB")),
+ Seq(1, 2, 3, 4, 5, 6)
+ ),
+ (
+ "UTF8_LCASE",
+ Seq((2, "bbb"), (1, "a"), (1, "A"), (1, "aaaa"), (3, "cc"), (2,
"BbB")),
+ Seq(1, 1, 1, 2, 2, 3)
+ ),
+ (
+ "UNICODE",
+ Seq((4, "bbb"), (1, "a"), (2, "A"), (3, "aaaa"), (6, "cc"), (5,
"BbB")),
+ Seq(1, 2, 3, 4, 5, 6)
+ ),
+ (
+ "UNICODE_CI",
+ Seq((2, "bbb"), (1, "a"), (1, "A"), (1, "aaaa"), (3, "cc"), (2,
"BbB")),
+ Seq(1, 1, 1, 2, 2, 3)
+ )
+ ).foreach {
+ case (collationName, data, expResult) =>
+ val collationSetup = if (collationName.isEmpty) "" else "collate " +
collationName
+ withTable(tableName) {
+ sql(s"create table $tableName (c1 integer, c2 string
$collationSetup)")
+ data.foreach {
+ case (c1, c2) =>
+ sql(s"insert into $tableName values ($c1, '$c2')")
+ }
+ checkAnswer(sql(s"select c1 from $tableName order by c2"),
expResult.map(Row(_)))
+ }
+ }
+ }
+
+ test("Check order by on partitioned table with collated string column") {
Review Comment:
do we need to test it? The Sort operator doesn't care how the data is
partitioned.
--
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]