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

    https://github.com/apache/spark/pull/16246#discussion_r92450051
  
    --- Diff: sql/core/src/test/resources/sql-tests/inputs/scalar-subquery.sql 
---
    @@ -0,0 +1,20 @@
    +CREATE OR REPLACE TEMPORARY VIEW p AS VALUES (1, 1) AS T(pk, pv);
    +CREATE OR REPLACE TEMPORARY VIEW c AS VALUES (1, 1) AS T(ck, cv);
    +
    +-- SPARK-18814.1: Simplified version of TPCDS-Q32
    +SELECT pk, cv
    +FROM   p, c
    +WHERE  p.pk = c.ck
    +AND    c.cv = (SELECT avg(c1.cv)
    +               FROM   c c1
    +               WHERE  c1.ck = p.pk);
    +
    +-- SPARK-18814.2: Adding stack of aggregates
    +SELECT pk, cv
    +FROM   p, c
    +WHERE  p.pk = c.ck
    +AND    c.cv = (SELECT max(avg)
    +          FROM   (SELECT   c1.cv, avg(c1.cv) avg
    +                  FROM     c c1
    +                  WHERE    c1.ck = p.pk
    +                       GROUP BY c1.cv));
    --- End diff --
    
    Or in some other cases, we should see the error message like 
    ```
    org.apache.spark.sql.AnalysisException: expression 'c1.`cv`' is neither 
present in the group by, nor is it an aggregate function.
    ```
    
    Both error handling are missing.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to