Dongjoon Hyun created SPARK-16590:
-------------------------------------

             Summary: 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.

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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to