[ 
https://issues.apache.org/jira/browse/SPARK-16621?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dongjoon Hyun updated SPARK-16621:
----------------------------------
    Issue Type: Sub-task  (was: Improvement)
        Parent: SPARK-16576

> Generate stable SQLs in SQLBuilder
> ----------------------------------
>
>                 Key: SPARK-16621
>                 URL: https://issues.apache.org/jira/browse/SPARK-16621
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>            Reporter: Dongjoon Hyun
>
> Currently, the generated SQLs have not-stable IDs for generated attributes.
> The stable generated SQL will give more benefit for understanding or testing 
> the queries. This issue provides stable SQL generation by the followings.
> * Provide unique ids for generated subqueries, `gen_subquery_xxx`.
> * Provide unique and stable ids for generated attributes, `gen_attr_xxx`.
> **Before**
> {code}
> 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
> {code}
> **After**
> {code}
> 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
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to