[
https://issues.apache.org/jira/browse/SPARK-58894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan resolved SPARK-58894.
---------------------------------
Fix Version/s: 4.3.0
Resolution: Fixed
Issue resolved by pull request 58146
[https://github.com/apache/spark/pull/58146]
> Detect cyclic view references in nested subqueries
> --------------------------------------------------
>
> Key: SPARK-58894
> URL: https://issues.apache.org/jira/browse/SPARK-58894
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 5.0.0
> Reporter: Manu Zhang
> Assignee: Manu Zhang
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.3.0
>
>
> `ViewHelper.checkCyclicViewReference` only inspects the root of each
> logical-plan expression when looking for subquery expressions. It detects an
> `EXISTS` subquery when that subquery is the expression root, but misses
> scalar and other subqueries nested inside larger expressions.
> For example:
> {code:sql}
> CREATE VIEW view1 AS SELECT * FROM jt;
> CREATE VIEW view2 AS SELECT * FROM view1;
> ALTER VIEW view1 AS SELECT * FROM jt WHERE id = (SELECT id FROM view2);
> {code}
> The last statement should fail with `RECURSIVE_VIEW`, reporting the cycle
> `view1 -> view2 -> view1`. Instead, the cyclic definition can be accepted and
> fail later during view resolution with the maximum nested-view-depth error.
> The cyclic-view check should traverse complete expression trees and inspect
> the plan of every nested `SubqueryExpression`. Add regression coverage for a
> scalar subquery nested below an equality predicate.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]