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] {
49
49
plan transform {
50
50
case a : Aggregate if a.resolved =>
51
51
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
+ }
61
59
if (complexGroupingExpressionMap.nonEmpty) {
62
60
def replaceComplexGroupingExpressions (e : Expression ): Expression = {
63
61
e match {
62
+ case _ if AggregateExpression .isAggregate(e) => e
64
63
case _ if e.foldable => e
65
64
case _ if complexGroupingExpressionMap.contains(e.canonicalized) =>
66
65
complexGroupingExpressionMap.get(e.canonicalized).map(_.toAttribute).getOrElse(e)
You can’t perform that action at this time.
0 commit comments