Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11846#discussion_r56930227
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -659,6 +662,40 @@ class Analyzer(
             }
             Sort(newOrders, global, child)
     
    +      // Replace the index with the corresponding expression in 
aggregateExpressions. The index is
    +      // a 1-base position of aggregateExpressions, which is output 
columns (select expression)
    +      case a @ Aggregate(groups, aggs, child)
    +          if conf.groupByOrdinal && child.resolved && 
aggs.forall(_.resolved) &&
    +            groups.exists(IntegerIndex.unapply(_).nonEmpty) =>
    +        val newGroups = groups.map {
    +          case IntegerIndex(index) if index > 0 && index <= aggs.size =>
    +            aggs(index - 1) match {
    +              case Alias(c, _) if c.isInstanceOf[AggregateExpression] =>
    --- End diff --
    
    We already have a method called `cotainsAggregate` somewhere, we should 
call it here. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to