Github user cloud-fan commented on the pull request: https://github.com/apache/spark/pull/8379#issuecomment-133831627 Before 1.5, `ExtractValue` chain may have intermedia and unnecessary `Alias`es inside it, so we trim `Alias`es upon `ExtractValue` before compare 2 `Expression`s in a lot places including [here](https://github.com/apache/spark/pull/8379/files#diff-820e654df2a5133c0f86c17e2fc5512eR165). However, when we use `transformDown`, we may loose the top level `Alias`. For example, `'a.getField("b")` is a grouping expression and `'a.getField("b").as("attribute")` is an aggregate expression, with `transformDown`, the rewritten aggregate expression will be `'a.getField("b")` which is wrong. The commit to fix the wrong `Alias` trimming is https://github.com/apache/spark/commit/da7bbb9435dae9a3bedad578599d96ea858f349e, which is not easy to backport I think. So maybe we need to add some ugly code to hadle the top level `Alias`es specially.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org