Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3910#discussion_r22875668
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
 ---
    @@ -153,11 +153,11 @@ object PartialAggregation {
                 partialEvaluations(new TreeNodeRef(e)).finalEvaluation
     
               case e: Expression =>
    -            // Should trim aliases around `GetField`s. These aliases are 
introduced while
    -            // resolving struct field accesses, because `GetField` is not 
a `NamedExpression`.
    -            // (Should we just turn `GetField` into a `NamedExpression`?)
                 namedGroupingExpressions
    -              .get(e.transform { case Alias(g: GetField, _) => g })
    +              // Should trim aliases. These aliases can only be introduced 
while resolving unnamed
    +              // expressions like `GetField` and UDF calls, because GROUP 
BY clause doesn't allow
    +              // aliasing.
    +              .get(e.transform { case a: Alias => a.child })
    --- End diff --
    
    Yeah, this issue puzzled me for a loooong time! I realized this solution is 
wrong. But I didn't figure out the right one until you pointed out that #3987 
(accidentally?) fixes this. Thanks!


---
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