GitHub user gatorsmile opened a pull request:

    https://github.com/apache/spark/pull/10963

    [SPARK-12989] [SQL] Delaying Alias Cleanup after ExtractWindowExpressions

    In the rule `ExtractWindowExpressions`, we simply replace alias by the 
name. However, this will cause an issue exposed by the following case:
    
    ```scala
    val data = Seq(("a", "b", "c", 3), ("c", "b", "a", 3)).toDF("A", "B", "C", 
"num")
      .withColumn("Data", struct("A", "B", "C"))
      .drop("A")
      .drop("B")
      .drop("C")
    
    val winSpec = Window.partitionBy("Data.A", "Data.B").orderBy($"num".desc)
    data.select($"*", max("num").over(winSpec) as "max").explain(true)
    ```
    In this case, both `Data.A` and `Data.B` are `alias` in 
`WindowSpecDefinition`. If we replace these alias expression by their alias 
names, we are unable to know what they are since they will not be put in 
`missingExpr` too. 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gatorsmile/spark seletStarAfterColDrop

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/10963.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #10963
    
----
commit 468abca15ae55a95b53fa427fbac7846e1da9f76
Author: gatorsmile <[email protected]>
Date:   2016-01-28T02:58:28Z

    delaying alias cleanup

----


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