File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -149,10 +149,24 @@ case class AggregateExpression(
149149 case PartialMerge => " merge_"
150150 case Final | Complete => " "
151151 }
152- prefix + aggregateFunction.toAggString(isDistinct)
152+ val aggFuncStr = prefix + aggregateFunction.toAggString(isDistinct)
153+ mode match {
154+ case Partial | Complete if filter.isDefined =>
155+ s " $aggFuncStr filter ${filter.get.toString}"
156+ case _ =>
157+ aggFuncStr
158+ }
153159 }
154160
155- override def sql : String = aggregateFunction.sql(isDistinct)
161+ override def sql : String = {
162+ val aggFuncStr = aggregateFunction.sql(isDistinct)
163+ mode match {
164+ case Partial | Complete if filter.isDefined =>
165+ s " $aggFuncStr FILTER ${filter.get.sql}"
166+ case _ =>
167+ aggFuncStr
168+ }
169+ }
156170}
157171
158172/**
You can’t perform that action at this time.
0 commit comments