You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (Jira)" <ji...@apache.org> on 2022/10/24 03:14:00 UTC

[jira] [Resolved] (SPARK-40800) Always inline expressions in OptimizeOneRowRelationSubquery

     [ https://issues.apache.org/jira/browse/SPARK-40800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wenchen Fan resolved SPARK-40800.
---------------------------------
    Fix Version/s: 3.4.0
       Resolution: Fixed

Issue resolved by pull request 38260
[https://github.com/apache/spark/pull/38260]

> Always inline expressions in OptimizeOneRowRelationSubquery
> -----------------------------------------------------------
>
>                 Key: SPARK-40800
>                 URL: https://issues.apache.org/jira/browse/SPARK-40800
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.4.0
>            Reporter: Allison Wang
>            Assignee: Allison Wang
>            Priority: Major
>             Fix For: 3.4.0
>
>
> SPARK-39699 made `CollpaseProjects` more conservative. This has impacted correlated subqueries that Spark used to be able to support. For example, a correlated one-row scalar subquery that has a higher-order function:
> {code:java}
> CREATE TEMP VIEW t1 AS SELECT ARRAY('a', 'b') a 
> SELECT (
>   SELECT array_sort(a, (i, j) -> rank[i] - rank[j]) AS sorted
>   FROM (SELECT MAP('a', 1, 'b', 2) rank)
> ) FROM t1{code}
> This will throw an exception after SPARK-39699:
> {code:java}
> Unexpected operator Join Inner
> :- Aggregate [[a,b]], [[a,b] AS a#252]
> :  +- OneRowRelation
> +- Project [map(keys: [a,b], values: [1,2]) AS rank#241]
>    +- OneRowRelation
>  in correlated subquery{code}
> because the projects inside the subquery can no longer be collapsed. We should always inline expressions if possible to avoid adding domain joins and support a wider range of correlated subqueries. 
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org