[ 
https://issues.apache.org/jira/browse/SPARK-42899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17894111#comment-17894111
 ] 

Cédric Chantepie commented on SPARK-42899:
------------------------------------------

Doesn't seem fixed, with 3.4.4 still raise Exception.

{{org.apache.spark.sql.AnalysisException: [NULLABLE_COLUMN_OR_FIELD] Column or 
field `datetraitement` is nullable while it's required to be non-nullable. 
(QueryCompilationErrors.scala:3193)}}

> DataFrame.to(schema) fails when it contains non-nullable nested field in 
> nullable field
> ---------------------------------------------------------------------------------------
>
>                 Key: SPARK-42899
>                 URL: https://issues.apache.org/jira/browse/SPARK-42899
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.4.0
>            Reporter: Takuya Ueshin
>            Assignee: Takuya Ueshin
>            Priority: Major
>             Fix For: 3.4.1
>
>
> {{DataFrame.to(schema)}} fails when it contains non-nullable nested field in 
> nullable field:
> {code:scala}
> scala> val df = spark.sql("VALUES (1, STRUCT(1 as i)), (NULL, NULL) as t(a, 
> b)")
> df: org.apache.spark.sql.DataFrame = [a: int, b: struct<i: int>]
> scala> df.printSchema()
> root
>  |-- a: integer (nullable = true)
>  |-- b: struct (nullable = true)
>  |    |-- i: integer (nullable = false)
> scala> df.to(df.schema)
> org.apache.spark.sql.AnalysisException: [NULLABLE_COLUMN_OR_FIELD] Column or 
> field `b`.`i` is nullable while it's required to be non-nullable.
> {code}



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

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

Reply via email to