Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14257#discussion_r72182312
  
    --- Diff: sql/hive/src/test/resources/sqlgen/predicate_subquery.sql ---
    @@ -1,4 +1,4 @@
     -- This file is automatically generated by LogicalPlanToSQLSuite.
     select * from t1 b where exists (select * from t1 a)
     
--------------------------------------------------------------------------------
    -SELECT `gen_attr` AS `a` FROM (SELECT `gen_attr` FROM (SELECT `a` AS 
`gen_attr` FROM `default`.`t1`) AS gen_subquery_0 WHERE EXISTS(SELECT 
`gen_attr` AS `a` FROM ((SELECT `gen_attr` FROM (SELECT `a` AS `gen_attr` FROM 
`default`.`t1`) AS gen_subquery_0) AS gen_subquery_1) AS gen_subquery_1)) AS b
    +SELECT `gen_attr_0` AS `a` FROM (SELECT `gen_attr_0` FROM (SELECT `a` AS 
`gen_attr_0` FROM `default`.`t1`) AS gen_subquery_0 WHERE EXISTS(SELECT 
`gen_attr_1` AS `a` FROM ((SELECT `gen_attr_1` FROM (SELECT `a` AS `gen_attr_1` 
FROM `default`.`t1`) AS gen_subquery_2) AS gen_subquery_1) AS gen_subquery_1)) 
AS b
    --- End diff --
    
    For this query, I reformatted like the following. Here, `gen_subquery_xxx`s 
are generated uniquely. But, `gen_subquery_1` is repeated due to the added 
nested subquery alias. Please note that it's not a repetition by duplicated ID 
and happens as a direct double nesting. I think it's okay.
    ```sql
    SELECT `gen_attr_0` AS `a`
    FROM (SELECT `gen_attr_0`
          FROM (SELECT `a` AS `gen_attr_0`
                FROM `default`.`t1`
               ) AS gen_subquery_0
          WHERE EXISTS(SELECT `gen_attr_1` AS `a`
                       FROM (  (SELECT `gen_attr_1`
                                FROM (SELECT `a` AS `gen_attr_1`
                                      FROM `default`.`t1`
                                     ) AS gen_subquery_2
                               ) AS gen_subquery_1
                            ) AS gen_subquery_1
                       )
         ) AS b
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to