From 5c2ae79bfcf448d8dc9217efafa1409997c739de Mon Sep 17 00:00:00 2001
From: Dongjoon Hyun <dongjoon@apache.org>
Date: Wed, 27 Jul 2016 23:29:26 -0700
Subject: [SPARK-15232][SQL] Add subquery SQL building tests to
 LogicalPlanToSQLSuite

## What changes were proposed in this pull request?

We currently test subquery SQL building using the `HiveCompatibilitySuite`. The is not desired since SQL building is actually a part of `sql/core` and because we are slowly reducing our dependency on Hive. This PR adds the same tests from the whitelist of `HiveCompatibilitySuite` into `LogicalPlanToSQLSuite`.

## How was this patch tested?

This adds more testcases. Pass the Jenkins tests.

Author: Dongjoon Hyun <dongjoon@apache.org>

Closes #14383 from dongjoon-hyun/SPARK-15232.
---
 .../src/test/resources/sqlgen/subquery_not_exists_having_2.sql   | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 sql/hive/src/test/resources/sqlgen/subquery_not_exists_having_2.sql

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

diff --git a/sql/hive/src/test/resources/sqlgen/subquery_not_exists_having_2.sql b/sql/hive/src/test/resources/sqlgen/subquery_not_exists_having_2.sql
new file mode 100644
index 0000000000..8b5402d8aa
--- /dev/null
+++ b/sql/hive/src/test/resources/sqlgen/subquery_not_exists_having_2.sql
@@ -0,0 +1,9 @@
+-- This file is automatically generated by LogicalPlanToSQLSuite.
+select *
+from src b
+group by key, value
+having not exists (select distinct a.key
+                   from src a
+                   where b.value = a.value and a.value > 'val_12')
+--------------------------------------------------------------------------------
+SELECT `gen_attr_2` AS `key`, `gen_attr_0` AS `value` FROM (SELECT `gen_attr_2`, `gen_attr_0` FROM (SELECT `key` AS `gen_attr_2`, `value` AS `gen_attr_0` FROM `default`.`src`) AS gen_subquery_0 GROUP BY `gen_attr_2`, `gen_attr_0` HAVING (NOT EXISTS(SELECT `gen_attr_3` AS `1` FROM (SELECT 1 AS `gen_attr_3` FROM (SELECT DISTINCT `gen_attr_4`, `gen_attr_1` FROM (SELECT `key` AS `gen_attr_4`, `value` AS `gen_attr_1` FROM `default`.`src`) AS gen_subquery_2 WHERE (`gen_attr_1` > "val_12")) AS gen_subquery_1 WHERE (`gen_attr_0` = `gen_attr_1`)) AS gen_subquery_3))) AS b
-- 
cgit v1.2.3

