[
https://issues.apache.org/jira/browse/SPARK-58779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18104890#comment-18104890
]
Avery Qi commented on SPARK-58779:
----------------------------------
[~avery_qi] is taking it
> InlineCTE throw errors when it is running in checkAnalysis for UDTF body
> having CTERelationRef but without CTERelationDef
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: SPARK-58779
> URL: https://issues.apache.org/jira/browse/SPARK-58779
> Project: Spark
> Issue Type: Bug
> Components: Optimizer, SQL
> Affects Versions: 4.1.0, 4.2.0, 4.3.0, 4.4.0
> Reporter: Avery Qi
> Priority: Major
>
> For the below example:
> ```
> CREATE TEMPORARY FUNCTION my_tvf(a INT, b INT) RETURNS TABLE(x INT)
> RETURN SELECT a + b AS x;
>
> WITH cte AS (SELECT 1 AS c1, 2 AS c2)
> SELECT * FROM my_tvf((SELECT c1 FROM cte), (SELECT c2 FROM cte));
> ```
> `ResolveSQLTableFunctions` calls `checkAnalysis` on the function body. The
> `checkAnalysis` then calls `inlineCTE` on the function body. But the function
> body only contains CTERelationRef, no CTERelationDef.
> InlineCTE then throws NoSuchElementException error when it encounter
> CTERelationRef but its cteId is not recorded in the cteMap.
> Spark need to either throws a clear Analysis Exception for this case or
> inlineCTE called in checkAnalysis should tolerant this.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]