superdiaodiao commented on code in PR #57298:
URL: https://github.com/apache/spark/pull/57298#discussion_r3604555953
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala:
##########
@@ -234,6 +234,16 @@ class DataFrameAggregateSuite extends SharedSparkSession
}
}
+ test("SPARK-38983: grouping functions in boolean expressions report type
mismatch") {
+ Seq(grouping("course"), grouping_id("course", "year")).foreach {
groupingExpr =>
+ val error = intercept[AnalysisException] {
+ courseSales.cube("course", "year").agg(groupingExpr &&
lit(true)).collect()
+ }
+ assert(error.getCondition === "DATATYPE_MISMATCH.BINARY_OP_DIFF_TYPES")
+ assert(!error.getMessage.contains("grouping()/grouping_id() can only be
used"))
Review Comment:
Thanks, updated the regression test to use the suite-idiomatic `checkError`
helper.
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala:
##########
@@ -234,6 +234,16 @@ class DataFrameAggregateSuite extends SharedSparkSession
}
}
+ test("SPARK-38983: grouping functions in boolean expressions report type
mismatch") {
+ Seq(grouping("course"), grouping_id("course", "year")).foreach {
groupingExpr =>
+ val error = intercept[AnalysisException] {
+ courseSales.cube("course", "year").agg(groupingExpr &&
lit(true)).collect()
Review Comment:
Done. The test now covers `cube`, `rollup`, and `groupingSets`, with both
`grouping()` and `grouping_id()` for each.
--
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]