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

ASF GitHub Bot updated SPARK-61579:
-----------------------------------
    Labels: pull-request-available  (was: )

> Read/write-side CHAR/VARCHAR processing drops a nested NOT NULL field when 
> rebuilding a struct
> ----------------------------------------------------------------------------------------------
>
>                 Key: SPARK-61579
>                 URL: https://issues.apache.org/jira/browse/SPARK-61579
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 5.0.0
>            Reporter: Linhong Liu
>            Priority: Major
>              Labels: pull-request-available
>
> CharVarcharUtils.processStringForCharVarchar rebuilds a struct containing a 
> CHAR/VARCHAR field as a named_struct of GetStructField(expr, i) values. 
> Because the struct `expr` is nullable, every GetStructField is nullable, so a 
> declared nested NOT NULL (e.g. STRUCT<c CHAR(2), z STRING NOT NULL>) is lost 
> in the rebuilt type. The re-typed attribute is then wider than the original, 
> which e.g. makes a Delta MERGE type check reject the assignment.
> Fix: preserve each field's declared nullability when rebuilding the struct 
> (wrap declared NOT NULL fields in KnownNotNull); the whole-struct-null case 
> is still handled by the surrounding null guard. Found via correctness 
> analysis.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to