You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2021/01/12 05:26:00 UTC

[jira] [Commented] (SPARK-34082) Window expression with alias inside WHERE and HAVING clauses fail with non-descriptive exceptions

    [ https://issues.apache.org/jira/browse/SPARK-34082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17263084#comment-17263084 ] 

Apache Spark commented on SPARK-34082:
--------------------------------------

User 'LantaoJin' has created a pull request for this issue:
https://github.com/apache/spark/pull/31146

> 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
>            Priority: Minor
>
> 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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org