[ https://issues.apache.org/jira/browse/SPARK-40974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17626489#comment-17626489 ]
Apache Spark commented on SPARK-40974: -------------------------------------- User 'clairezhuang' has created a pull request for this issue: https://github.com/apache/spark/pull/38446 > EXPODE function selects outer column > ------------------------------------ > > Key: SPARK-40974 > URL: https://issues.apache.org/jira/browse/SPARK-40974 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 3.3.0 > Reporter: Omar Ismail > Priority: Minor > > Im trying to determine if indirectly selecting an outer column is a bug or an > intended feature of the EXPLODE function. > > If I run the following SQL statement: > ``` > SELECT > (SELECT FIRST(name_element_) > FROM LATERAL VIEW EXPLODE(name) AS name_element_ > *)* > FROM patient > ``` > > it fails with: > ``` > Accessing outer query column is not allowed in: > Generate explode(outer(name#9628)) > ``` > > However, if I do a "cheeky select" (bolded below), the SQL query is valid and > runs: > ``` > SELECT( > SELECT FIRST(name_element_) > FROM (SELECT EXPLODE(name_element_) AS name_element_ > \{*}FROM ({*}{*}SELECT{*} *name AS name_element_)* > ** ) > ) > FROM patient > ``` > From the viewpoint of the EXPLODE function, it seems like the column > name_element_ does not come from an outer column. Is this an intended feature > or a bug? -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org