[
https://issues.apache.org/jira/browse/SPARK-32641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan resolved SPARK-32641.
---------------------------------
Fix Version/s: 3.1.0
Resolution: Fixed
Issue resolved by pull request 29522
[https://github.com/apache/spark/pull/29522]
> withField + getField on null structs returns incorrect results
> --------------------------------------------------------------
>
> Key: SPARK-32641
> URL: https://issues.apache.org/jira/browse/SPARK-32641
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.1.0
> Reporter: fqaiser94
> Assignee: fqaiser94
> Priority: Major
> Fix For: 3.1.0
>
>
>
> There is a bug in the way the optimizer rule in SimplifyExtractValueOps
> (sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/ComplexTypes.scala)
> is currently coded which yields incorrect results in scenarios like the
> following:
> {code:java}
> sql("SELECT CAST(NULL AS struct<a:int,b:int>) struct_col")
> .select($"struct_col".withField("d", lit(4)).getField("d").as("d"))
> // currently returns this:
> +---+
> |d |
> +---+
> |4 |
> +---+
> // when in fact it should return this:
> +----+
> |d |
> +----+
> |null|
> +----+
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]