You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (Jira)" <ji...@apache.org> on 2020/02/19 18:20:00 UTC

[jira] [Commented] (SPARK-30811) CTE that refers to non-existent table with same name causes StackOverflowError

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

Dongjoon Hyun commented on SPARK-30811:
---------------------------------------

The test cases are landed to `master/branch-3.0` to prevent future regression.
- https://github.com/apache/spark/pull/27635

> CTE that refers to non-existent table with same name causes StackOverflowError
> ------------------------------------------------------------------------------
>
>                 Key: SPARK-30811
>                 URL: https://issues.apache.org/jira/browse/SPARK-30811
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.2, 2.1.3, 2.2.3, 2.3.4, 2.4.5
>            Reporter: Herman van Hövell
>            Assignee: Herman van Hövell
>            Priority: Major
>             Fix For: 2.4.6
>
>
> The following query causes a StackOverflowError:
> {noformat}
> WITH t AS (SELECT 1 FROM nonexist.t) SELECT * FROM t
> {noformat}
> This only happens when the CTE refers to a non-existent table with the same name and a database qualifier. This is caused by a couple of things:
>  * {{CTESubstitution}} runs analysis on the CTE, but this does not throw an exception because the table has a database qualifier. The reason is that we don't fail is because we re-attempt to resolve the relation in a later rule.
>  * {{CTESubstitution}} replace logic does not check if the table it is replacing has a database, it shouldn't replace the relation if it does. So now we will happily replace {{nonexist.t}} with {{t}}.
>  * {{CTESubstitution}} transforms down, this means it will keep replacing {{t}} with itself, creating an infinite recursion.
> This is not an issue for master/3.0.



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