From ea78edb80bf46e925d53e2aec29666c4eeb66188 Mon Sep 17 00:00:00 2001
From: Dongjoon Hyun <dongjoon@apache.org>
Date: Mon, 18 Jul 2016 17:17:37 -0700
Subject: [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.
---
 sql/hive/src/test/resources/sqlgen/rollup_cube_4_1.sql | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 sql/hive/src/test/resources/sqlgen/rollup_cube_4_1.sql

(limited to 'sql/hive/src/test/resources/sqlgen/rollup_cube_4_1.sql')

diff --git a/sql/hive/src/test/resources/sqlgen/rollup_cube_4_1.sql b/sql/hive/src/test/resources/sqlgen/rollup_cube_4_1.sql
new file mode 100644
index 0000000000..be4908ea16
--- /dev/null
+++ b/sql/hive/src/test/resources/sqlgen/rollup_cube_4_1.sql
@@ -0,0 +1,5 @@
+-- This file is automatically generated by LogicalPlanToSQLSuite.
+SELECT count(*) as cnt, key % 5 as k1, key - 5 as k2, grouping_id() FROM parquet_t1
+GROUP BY key % 5, key - 5 WITH ROLLUP
+--------------------------------------------------------------------------------
+SELECT `gen_attr` AS `cnt`, `gen_attr` AS `k1`, `gen_attr` AS `k2`, `gen_attr` AS `grouping_id()` FROM (SELECT count(1) AS `gen_attr`, (`gen_attr` % CAST(5 AS BIGINT)) AS `gen_attr`, (`gen_attr` - CAST(5 AS BIGINT)) AS `gen_attr`, grouping_id() AS `gen_attr` FROM (SELECT `key` AS `gen_attr`, `value` AS `gen_attr` FROM `default`.`parquet_t1`) AS gen_subquery_0 GROUP BY (`gen_attr` % CAST(5 AS BIGINT)), (`gen_attr` - CAST(5 AS BIGINT)) GROUPING SETS(((`gen_attr` % CAST(5 AS BIGINT)), (`gen_attr` - CAST(5 AS BIGINT))), ((`gen_attr` % CAST(5 AS BIGINT))), ())) AS gen_subquery_1
-- 
cgit v1.2.3

