[ https://issues.apache.org/jira/browse/SPARK-42899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Takuya Ueshin updated SPARK-42899: ---------------------------------- Summary: DataFrame.to(schema) fails when it contains non-nullable nested field in nullable field (was: DataFrame.to(schema) fails with the schema of itself.) > 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 > Priority: Major > > {{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: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org