You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Herman van Hövell (Jira)" <ji...@apache.org> on 2020/02/13 13:46:00 UTC
[jira] [Assigned] (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:all-tabpanel ]
Herman van Hövell reassigned SPARK-30811:
-----------------------------------------
Assignee: Herman van Hövell
> 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.4.5
> Reporter: Herman van Hövell
> Assignee: Herman van Hövell
> Priority: Major
>
> 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