Lantao Jin created SPARK-34082:
----------------------------------

             Summary: Window expression with alias inside WHERE and HAVING 
clauses fail with non-descriptive exceptions
                 Key: SPARK-34082
                 URL: https://issues.apache.org/jira/browse/SPARK-34082
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.0.2, 3.2.0, 3.1.1
            Reporter: Lantao Jin


SPARK-24575 prohibits window expressions inside WHERE and HAVING clauses. But 
if the window expression with alias inside WHERE and HAVING clauses, Spark does 
not handle this explicitly and will fail with non-descriptive exceptions.
{code}
SELECT a, RANK() OVER(ORDER BY b) AS s FROM testData2 WHERE b = 2 AND s = 1
{code}
{code}
cannot resolve '`s`' given input columns: [testdata2.a, testdata2.b]
{code}
{code}
SELECT a, MAX(b), RANK() OVER(ORDER BY a) AS s
FROM testData2
GROUP BY a
HAVING SUM(b) = 5 AND s = 1
{code}
{code}
cannot resolve '`b`' given input columns: [testdata2.a, max(b)]
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to