Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.1, 2.1.0
    • SQL
    • None

    Description

      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*

      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
      

      Attachments

        Activity

          People

            dongjoon Dongjoon Hyun
            dongjoon Dongjoon Hyun
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: