Skip to content

Commit e54839b

Browse files
committed
Fix
1 parent 81e1a21 commit e54839b

File tree

1 file changed

+16
-2
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate

1 file changed

+16
-2
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/interfaces.scala

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff 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
/**

0 commit comments

Comments
 (0)