You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2016/07/17 01:42:20 UTC

[jira] [Updated] (SPARK-16590) Improve LogicalPlanToSQLSuite to check generated SQL directly

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

Dongjoon Hyun updated SPARK-16590:
----------------------------------
    Description: 
This issue improves `LogicalPlanToSQLSuite` to check the generated SQL directly by *structure*. So far, `LogicalPlanToSQLSuite` relies on  `checkHiveQl` to ensure the *successful SQL generation* and *answer equality*. However, it does not guarantee the generated SQL is the same and will not be changed unnoticeably.

The following is an example result of this issue. 
{code}
-    checkHiveQl("SELECT * FROM parquet_t0 TABLESAMPLE(0.1 PERCENT) WHERE 1=0")
+    checkHiveQl("SELECT * FROM parquet_t0 TABLESAMPLE(0.1 PERCENT) WHERE 1=0",
+      """
+        |SELECT `gen_attr` AS `id`
+        |FROM (SELECT `gen_attr`
+        |      FROM (SELECT `id` AS `gen_attr`
+        |            FROM `default`.`parquet_t0`
+        |            TABLESAMPLE(0.1 PERCENT))
+        |            AS gen_subquery_0
+        |      WHERE (1 = 0))
+        |      AS parquet_t0
+      """.stripMargin)
{code}


  was:
This issue improves `LogicalPlanToSQLSuite` to check the generated SQL directly by *structure*. So far, `LogicalPlanToSQLSuite` relies on  `checkHiveQl` to ensure the *successful SQL generation* and *answer equality*. However, it does not guarantee the generated SQL is the same.

The following is an example result of this issue. 
{code}
-    checkHiveQl("SELECT * FROM parquet_t0 TABLESAMPLE(0.1 PERCENT) WHERE 1=0")
+    checkHiveQl("SELECT * FROM parquet_t0 TABLESAMPLE(0.1 PERCENT) WHERE 1=0",
+      """
+        |SELECT `gen_attr` AS `id`
+        |FROM (SELECT `gen_attr`
+        |      FROM (SELECT `id` AS `gen_attr`
+        |            FROM `default`.`parquet_t0`
+        |            TABLESAMPLE(0.1 PERCENT))
+        |            AS gen_subquery_0
+        |      WHERE (1 = 0))
+        |      AS parquet_t0
+      """.stripMargin)
{code}



> Improve LogicalPlanToSQLSuite to check generated SQL directly
> -------------------------------------------------------------
>
>                 Key: SPARK-16590
>                 URL: https://issues.apache.org/jira/browse/SPARK-16590
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Dongjoon Hyun
>
> This issue improves `LogicalPlanToSQLSuite` to check the generated SQL directly by *structure*. So far, `LogicalPlanToSQLSuite` relies on  `checkHiveQl` to ensure the *successful SQL generation* and *answer equality*. However, it does not guarantee the generated SQL is the same and will not be changed unnoticeably.
> The following is an example result of this issue. 
> {code}
> -    checkHiveQl("SELECT * FROM parquet_t0 TABLESAMPLE(0.1 PERCENT) WHERE 1=0")
> +    checkHiveQl("SELECT * FROM parquet_t0 TABLESAMPLE(0.1 PERCENT) WHERE 1=0",
> +      """
> +        |SELECT `gen_attr` AS `id`
> +        |FROM (SELECT `gen_attr`
> +        |      FROM (SELECT `id` AS `gen_attr`
> +        |            FROM `default`.`parquet_t0`
> +        |            TABLESAMPLE(0.1 PERCENT))
> +        |            AS gen_subquery_0
> +        |      WHERE (1 = 0))
> +        |      AS parquet_t0
> +      """.stripMargin)
> {code}



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

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