diff options
author | Dongjoon Hyun <dongjoon@apache.org> | 2016-07-18 17:17:37 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-07-18 17:17:37 -0700 |
commit | ea78edb80bf46e925d53e2aec29666c4eeb66188 (patch) | |
tree | 49dcd9199c4443b42f91e84a0a9f7b794d8846d9 /sql/hive/src/test/resources/sqlgen/rollup_cube_9_2.sql | |
parent | 75f0efe74d0c9a7acb525339c5184b99fee4dafc (diff) | |
download | spark-ea78edb80bf46e925d53e2aec29666c4eeb66188.tar.gz spark-ea78edb80bf46e925d53e2aec29666c4eeb66188.tar.bz2 spark-ea78edb80bf46e925d53e2aec29666c4eeb66188.zip |
[SPARK-16590][SQL] Improve LogicalPlanToSQLSuite to check generated SQL directly
## What changes were proposed in this pull request?
This PR 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 or will not be changed unnoticeably.
## How was this patch tested?
Pass the Jenkins. This is only a testsuite change.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes #14235 from dongjoon-hyun/SPARK-16590.
Diffstat (limited to 'sql/hive/src/test/resources/sqlgen/rollup_cube_9_2.sql')
-rw-r--r-- | sql/hive/src/test/resources/sqlgen/rollup_cube_9_2.sql | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/hive/src/test/resources/sqlgen/rollup_cube_9_2.sql b/sql/hive/src/test/resources/sqlgen/rollup_cube_9_2.sql new file mode 100644 index 0000000000..fe98b6c343 --- /dev/null +++ b/sql/hive/src/test/resources/sqlgen/rollup_cube_9_2.sql @@ -0,0 +1,8 @@ +-- This file is automatically generated by LogicalPlanToSQLSuite. +SELECT t.key - 5, cnt, SUM(cnt) +FROM (SELECT x.key, COUNT(*) as cnt +FROM parquet_t1 x JOIN parquet_t1 y ON x.key = y.key GROUP BY x.key) t +GROUP BY cnt, t.key - 5 +WITH CUBE +-------------------------------------------------------------------------------- +SELECT `gen_attr` AS `(key - CAST(5 AS BIGINT))`, `gen_attr` AS `cnt`, `gen_attr` AS `sum(cnt)` FROM (SELECT (`gen_attr` - CAST(5 AS BIGINT)) AS `gen_attr`, `gen_attr` AS `gen_attr`, sum(`gen_attr`) AS `gen_attr` FROM (SELECT `gen_attr`, count(1) AS `gen_attr` FROM (SELECT `key` AS `gen_attr`, `value` AS `gen_attr` FROM `default`.`parquet_t1`) AS gen_subquery_0 INNER JOIN (SELECT `key` AS `gen_attr`, `value` AS `gen_attr` FROM `default`.`parquet_t1`) AS gen_subquery_1 ON (`gen_attr` = `gen_attr`) GROUP BY `gen_attr`) AS t GROUP BY `gen_attr`, (`gen_attr` - CAST(5 AS BIGINT)) GROUPING SETS((`gen_attr`, (`gen_attr` - CAST(5 AS BIGINT))), (`gen_attr`), ((`gen_attr` - CAST(5 AS BIGINT))), ())) AS gen_subquery_2 |