GitHub user dongjoon-hyun opened a pull request:

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

    [SPARK-16621][SQL][WIP] Use a stable ID generation method for attributes in 
SQLBuilder

    ## What changes were proposed in this pull request?
    
    Currently, the generated SQL has stable IDs for `subquery`, but not-stable 
IDs for `gen_attr`. This issue provides stable IDs for `gen_attr`, too.
    
    The stable generated SQL will give more benefit for understanding or 
testing the queries.
    
    **Before**
    ```
    scala> new org.apache.spark.sql.catalyst.SQLBuilder(sql("select 1")).toSQL
    res0: String = SELECT `gen_attr_0` AS `1` FROM (SELECT 1 AS `gen_attr_0`) 
AS gen_subquery_0
    scala> new org.apache.spark.sql.catalyst.SQLBuilder(sql("select 1")).toSQL
    res1: String = SELECT `gen_attr_4` AS `1` FROM (SELECT 1 AS `gen_attr_4`) 
AS gen_subquery_0
    ```
    
    **After**
    ```
    scala> new org.apache.spark.sql.catalyst.SQLBuilder(sql("select 1")).toSQL
    res1: String = SELECT `gen_attr_0` AS `1` FROM (SELECT 1 AS `gen_attr_0`) 
AS gen_subquery_0
    
    scala> new org.apache.spark.sql.catalyst.SQLBuilder(sql("select 1")).toSQL
    res2: String = SELECT `gen_attr_0` AS `1` FROM (SELECT 1 AS `gen_attr_0`) 
AS gen_subquery_0
    ```
    
    TODO:
     - [x] Pass the HiveCompatibilitySuite.
    
    ## How was this patch tested?
    
    Pass the existing Jenkins tests.

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

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-16621

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

    https://github.com/apache/spark/pull/14257.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 #14257
    
----
commit 2699f9e3ed31f938f3fd695dcd3d376969ea7d1a
Author: Dongjoon Hyun <[email protected]>
Date:   2016-07-19T07:35:38Z

    [SPARK-16621][SQL] Use a stable ID generation method for attributes in 
SQLBuilder

----


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