File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -49,18 +49,17 @@ object PullOutGroupingExpressions extends Rule[LogicalPlan] {
4949 plan transform {
5050 case a : Aggregate if a.resolved =>
5151 val complexGroupingExpressionMap = mutable.LinkedHashMap .empty[Expression , NamedExpression ]
52- val newGroupingExpressions = a.groupingExpressions
53- .filterNot(AggregateExpression .containsAggregate)
54- .map {
55- case e if ! e.foldable && e.children.nonEmpty =>
56- complexGroupingExpressionMap
57- .getOrElseUpdate(e.canonicalized, Alias (e, s " _groupingexpression " )())
58- .toAttribute
59- case o => o
60- }
52+ val newGroupingExpressions = a.groupingExpressions.map {
53+ case e if ! e.foldable && e.children.nonEmpty =>
54+ complexGroupingExpressionMap
55+ .getOrElseUpdate(e.canonicalized, Alias (e, s " _groupingexpression " )())
56+ .toAttribute
57+ case o => o
58+ }
6159 if (complexGroupingExpressionMap.nonEmpty) {
6260 def replaceComplexGroupingExpressions (e : Expression ): Expression = {
6361 e match {
62+ case _ if AggregateExpression .isAggregate(e) => e
6463 case _ if e.foldable => e
6564 case _ if complexGroupingExpressionMap.contains(e.canonicalized) =>
6665 complexGroupingExpressionMap.get(e.canonicalized).map(_.toAttribute).getOrElse(e)
You can’t perform that action at this time.
0 commit comments