Github user JasonMWhite commented on the issue:
https://github.com/apache/spark/pull/17293
This issue causes a lot of headaches for us when picking up parquet
datasets. To get around this issue, we write the schema alongside the parquet
files in a side-band, and then when loading, create the correct schema object
(with non-nullable columns) and swap it in, like so:
```
schema = read_schema_file(path)
new_java_schema =
spark._jvm.org.apache.spark.sql.types.DataType.fromJson(schema.json())
java_rdd = data_frame._jdf.toJavaRDD()
new_jdf = spark._jsparkSession.createDataFrame(java_rdd,
new_java_schema)
return sql.DataFrame(new_jdf, data_frame.sql_ctx)
```
This is extremely ugly code, particularly in PySpark, and I'd rather remove
it. I don't see why we wouldn't want to trust the nullable flags that Spark
itself correctly writes to parquet files.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]