dbatomic commented on code in PR #46640:
URL: https://github.com/apache/spark/pull/46640#discussion_r1622373733
##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSuite.scala:
##########
@@ -999,6 +1000,113 @@ class CollationSuite extends DatasourceV2SQLBase with
AdaptiveSparkPlanHelper {
}
}
+ test("RewriteGroupByCollation rule works for string") {
+ val dataType = StringType(CollationFactory.collationNameToId("UNICODE_CI"))
+ val schema = StructType(Seq(StructField("name", dataType)))
+ val data = Seq(Row("AA"), Row("aa"), Row("BB"))
+ val df = spark.createDataFrame(spark.sparkContext.parallelize(data),
schema)
+ df.createOrReplaceTempView("tempTable")
+ // test RewriteGroupByCollation idempotence
+ val dfGroupBy1 = spark.sql("SELECT COUNT(*) FROM tempTable GROUP BY name")
+ val logicalPlan1 = dfGroupBy1.queryExecution.analyzed
+ val newPlan1 = RewriteGroupByCollation(logicalPlan1)
+ val newNewPlan1 = RewriteGroupByCollation(newPlan1)
+ assert(newPlan1 == newNewPlan1)
+ // get the query execution result
Review Comment:
this comment is not super useful :)
we should be adding more detailed comments for many things, but
`checkAnswer` is pretty self descriptive :)
--
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]