Skip to content
Snippets Groups Projects
  • Dongjoon Hyun's avatar
    5c2ae79b
    [SPARK-15232][SQL] Add subquery SQL building tests to LogicalPlanToSQLSuite · 5c2ae79b
    Dongjoon Hyun authored
    ## 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.
    5c2ae79b
    History
    [SPARK-15232][SQL] Add subquery SQL building tests to LogicalPlanToSQLSuite
    Dongjoon Hyun authored
    ## 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.
subquery_exists_2.sql 939 B
-- This file is automatically generated by LogicalPlanToSQLSuite.
select *
from (select *
      from src b
      where exists (select a.key
                    from src a
                    where b.value = a.value and a.key = b.key and a.value > 'val_9')) a
--------------------------------------------------------------------------------
SELECT `gen_attr_0` AS `key`, `gen_attr_1` AS `value` FROM (SELECT `gen_attr_0`, `gen_attr_1` FROM (SELECT `gen_attr_0`, `gen_attr_1` FROM (SELECT `key` AS `gen_attr_0`, `value` AS `gen_attr_1` FROM `default`.`src`) AS gen_subquery_0 WHERE EXISTS(SELECT `gen_attr_4` AS `1` FROM (SELECT 1 AS `gen_attr_4` FROM (SELECT `gen_attr_3`, `gen_attr_2` FROM (SELECT `key` AS `gen_attr_3`, `value` AS `gen_attr_2` FROM `default`.`src`) AS gen_subquery_2 WHERE (`gen_attr_2` > "val_9")) AS gen_subquery_1 WHERE ((`gen_attr_1` = `gen_attr_2`) AND (`gen_attr_3` = `gen_attr_0`))) AS gen_subquery_3)) AS a) AS a