cloud-fan commented on a change in pull request #27198:
[SPARK-27986][SQL][FOLLOWUP] Respect filter in sql/toString of
AggregateExpression
URL: https://github.com/apache/spark/pull/27198#discussion_r366742573
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggUtils.scala
##########
@@ -19,14 +19,29 @@ package org.apache.spark.sql.execution.aggregate
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.expressions.aggregate._
-import org.apache.spark.sql.catalyst.optimizer.NormalizeFloatingNumbers
import org.apache.spark.sql.execution.SparkPlan
import org.apache.spark.sql.execution.streaming.{StateStoreRestoreExec,
StateStoreSaveExec}
/**
* Utility functions used by the query planner to convert our plan to new
aggregation code path.
*/
object AggUtils {
+
+ private def mayRemoveAggFilters(exprs: Seq[AggregateExpression]):
Seq[AggregateExpression] = {
+ exprs.map { ae =>
+ if (ae.filter.isDefined) {
+ ae.mode match {
+ // Aggregate filters are applicable only in partial/complete modes;
+ // this method filters out them, otherwise.
+ case Partial | Complete => ae
+ case _ => ae.copy(filter = None)
Review comment:
We can also simplify `AggregateExpression.references` now
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]