sarutak commented on code in PR #60366:
URL: https://github.com/apache/spark/pull/60366#discussion_r4550940889
##########
sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala:
##########
@@ -1874,6 +1874,89 @@ class SubquerySuite extends SharedSparkSession
checkAnswer(df, Nil)
}
+ test("SPARK-61482: COUNT bug of a lower aggregate with an expression over
aggregate functions") {
+ // `ml` keeps only the rows of `l` with matching rows in `r`.
+ withTempView("ml") {
+ sql("CREATE TEMPORARY VIEW ml AS SELECT * FROM l WHERE a > 1")
+ withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
+ // The expression over COUNT(*) fails on zero tuples, but is not
evaluated on them
+ // while the query is optimized.
Review Comment:
Done, applied your rewording: the failing zero-tuple value sits in a
conditional branch, where
constant folding tolerates the failure while optimizing, rather than not
being evaluated.
--
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]