Github user nsyca commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16760#discussion_r98794661
  
    --- Diff: 
sql/core/src/test/resources/sql-tests/results/subquery/exists-subquery/exists-orderby-limit.sql.out
 ---
    @@ -0,0 +1,222 @@
    +-- Automatically generated by SQLQueryTestSuite
    +-- Number of queries: 12
    +
    +
    +-- !query 0
    +CREATE TEMPORARY VIEW EMP AS SELECT * FROM VALUES
    +  (100, "emp 1", date "2005-01-01", 100.00D, 10),
    +  (100, "emp 1", date "2005-01-01", 100.00D, 10),
    +  (200, "emp 2", date "2003-01-01", 200.00D, 10),
    +  (300, "emp 3", date "2002-01-01", 300.00D, 20),
    +  (400, "emp 4", date "2005-01-01", 400.00D, 30),
    +  (500, "emp 5", date "2001-01-01", 400.00D, NULL),
    +  (600, "emp 6 - no dept", date "2001-01-01", 400.00D, 100),
    +  (700, "emp 7", date "2010-01-01", 400.00D, 100),
    +  (800, "emp 8", date "2016-01-01", 150.00D, 70)
    +AS EMP(id, emp_name, hiredate, salary, dept_id)
    +-- !query 0 schema
    +struct<>
    +-- !query 0 output
    +
    +
    +
    +-- !query 1
    +CREATE TEMPORARY VIEW DEPT AS SELECT * FROM VALUES
    +  (10, "dept 1", "CA"),
    +  (20, "dept 2", "NY"),
    +  (30, "dept 3", "TX"),
    +  (40, "dept 4 - unassigned", "OR"),
    +  (50, "dept 5 - unassigned", "NJ"),
    +  (70, "dept 7", "FL")
    +AS DEPT(dept_id, dept_name, state)
    +-- !query 1 schema
    +struct<>
    +-- !query 1 output
    +
    +
    +
    +-- !query 2
    +CREATE TEMPORARY VIEW BONUS AS SELECT * FROM VALUES
    +  ("emp 1", 10.00D),
    +  ("emp 1", 20.00D),
    +  ("emp 2", 300.00D),
    +  ("emp 2", 100.00D),
    +  ("emp 3", 300.00D),
    +  ("emp 4", 100.00D),
    +  ("emp 5", 1000.00D),
    +  ("emp 6 - no dept", 500.00D)
    +AS BONUS(emp_name, bonus_amt)
    +-- !query 2 schema
    +struct<>
    +-- !query 2 output
    +
    +
    +
    +-- !query 3
    +SELECT * 
    +FROM   emp 
    +WHERE  EXISTS (SELECT dept.dept_id 
    +               FROM   dept 
    +               WHERE  emp.dept_id = dept.dept_id 
    +               ORDER  BY state) 
    +ORDER  BY hiredate
    +-- !query 3 schema
    +struct<id:int,emp_name:string,hiredate:date,salary:double,dept_id:int>
    +-- !query 3 output
    +300        emp 3   2002-01-01      300.0   20
    +200        emp 2   2003-01-01      200.0   10
    +100        emp 1   2005-01-01      100.0   10
    +100        emp 1   2005-01-01      100.0   10
    +400        emp 4   2005-01-01      400.0   30
    +800        emp 8   2016-01-01      150.0   70
    +
    +
    +-- !query 4
    +SELECT id, 
    +       hiredate 
    +FROM   emp 
    +WHERE  EXISTS (SELECT dept.dept_id 
    +               FROM   dept 
    +               WHERE  emp.dept_id = dept.dept_id 
    +               ORDER  BY state) 
    +ORDER  BY hiredate DESC
    +-- !query 4 schema
    +struct<id:int,hiredate:date>
    +-- !query 4 output
    +800        2016-01-01
    +100        2005-01-01
    +100        2005-01-01
    +400        2005-01-01
    +200        2003-01-01
    +300        2002-01-01
    +
    +
    +-- !query 5
    +SELECT * 
    +FROM   emp 
    +WHERE  NOT EXISTS (SELECT dept.dept_id 
    +                   FROM   dept 
    +                   WHERE  emp.dept_id = dept.dept_id 
    +                   ORDER  BY state) 
    +ORDER  BY hiredate
    +-- !query 5 schema
    +struct<id:int,emp_name:string,hiredate:date,salary:double,dept_id:int>
    +-- !query 5 output
    +500        emp 5   2001-01-01      400.0   NULL
    +600        emp 6 - no dept 2001-01-01      400.0   100
    +700        emp 7   2010-01-01      400.0   100
    +
    +
    +-- !query 6
    +SELECT emp_name 
    +FROM   emp 
    +WHERE  NOT EXISTS (SELECT max(dept.dept_id) a 
    +                   FROM   dept 
    +                   WHERE  dept.dept_id = emp.dept_id 
    +                   GROUP  BY state 
    +                   ORDER  BY state)
    +-- !query 6 schema
    +struct<emp_name:string>
    +-- !query 6 output
    +emp 5
    +emp 6 - no dept
    +emp 7
    +
    +
    +-- !query 7
    +SELECT count(*) 
    +FROM   emp 
    +WHERE  NOT EXISTS (SELECT max(dept.dept_id) a 
    +                   FROM   dept 
    +                   WHERE  dept.dept_id = emp.dept_id 
    +                   GROUP  BY dept_id 
    +                   ORDER  BY dept_id)
    +-- !query 7 schema
    +struct<count(1):bigint>
    +-- !query 7 output
    +3
    +
    +
    +-- !query 8
    +SELECT * 
    +FROM   emp 
    +WHERE  EXISTS (SELECT dept.dept_name 
    +               FROM   dept 
    +               WHERE  dept.dept_id > 10 
    +               LIMIT  1)
    +-- !query 8 schema
    +struct<id:int,emp_name:string,hiredate:date,salary:double,dept_id:int>
    +-- !query 8 output
    +100        emp 1   2005-01-01      100.0   10
    +100        emp 1   2005-01-01      100.0   10
    +200        emp 2   2003-01-01      200.0   10
    +300        emp 3   2002-01-01      300.0   20
    +400        emp 4   2005-01-01      400.0   30
    +500        emp 5   2001-01-01      400.0   NULL
    +600        emp 6 - no dept 2001-01-01      400.0   100
    +700        emp 7   2010-01-01      400.0   100
    +800        emp 8   2016-01-01      150.0   70
    +
    +
    +-- !query 9
    +SELECT * 
    +FROM   emp 
    +WHERE  EXISTS (SELECT max(dept.dept_id) 
    +               FROM   dept 
    +               GROUP  BY state 
    +               LIMIT  1)
    +-- !query 9 schema
    +struct<id:int,emp_name:string,hiredate:date,salary:double,dept_id:int>
    +-- !query 9 output
    +100        emp 1   2005-01-01      100.0   10
    +100        emp 1   2005-01-01      100.0   10
    +200        emp 2   2003-01-01      200.0   10
    +300        emp 3   2002-01-01      300.0   20
    +400        emp 4   2005-01-01      400.0   30
    +500        emp 5   2001-01-01      400.0   NULL
    +600        emp 6 - no dept 2001-01-01      400.0   100
    +700        emp 7   2010-01-01      400.0   100
    +800        emp 8   2016-01-01      150.0   70
    +
    +
    +-- !query 10
    +SELECT * 
    +FROM   emp 
    +WHERE  NOT EXISTS (SELECT dept.dept_name 
    +                   FROM   dept 
    +                   WHERE  dept.dept_id > 100 
    +                   LIMIT  1)
    +-- !query 10 schema
    +struct<id:int,emp_name:string,hiredate:date,salary:double,dept_id:int>
    +-- !query 10 output
    +100        emp 1   2005-01-01      100.0   10
    +100        emp 1   2005-01-01      100.0   10
    +200        emp 2   2003-01-01      200.0   10
    +300        emp 3   2002-01-01      300.0   20
    +400        emp 4   2005-01-01      400.0   30
    +500        emp 5   2001-01-01      400.0   NULL
    +600        emp 6 - no dept 2001-01-01      400.0   100
    +700        emp 7   2010-01-01      400.0   100
    +800        emp 8   2016-01-01      150.0   70
    +
    +
    +-- !query 11
    +SELECT * 
    +FROM   emp 
    +WHERE  NOT EXISTS (SELECT max(dept.dept_id) 
    +                   FROM   dept 
    +                   WHERE  dept.dept_id > 100 
    +                   GROUP  BY state 
    +                   LIMIT  1)
    +-- !query 11 schema
    +struct<id:int,emp_name:string,hiredate:date,salary:double,dept_id:int>
    +-- !query 11 output
    +100        emp 1   2005-01-01      100.0   10
    +100        emp 1   2005-01-01      100.0   10
    +200        emp 2   2003-01-01      200.0   10
    +300        emp 3   2002-01-01      300.0   20
    +400        emp 4   2005-01-01      400.0   30
    +500        emp 5   2001-01-01      400.0   NULL
    +600        emp 6 - no dept 2001-01-01      400.0   100
    +700        emp 7   2010-01-01      400.0   100
    +800        emp 8   2016-01-01      150.0   70
    --- End diff --
    
    I have compared the result set matched with the result from DB2.


---
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