Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/4826#discussion_r25593397
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetRelation.scala ---
@@ -172,9 +173,14 @@ private[sql] object ParquetRelation {
sqlContext.conf.parquetCompressionCodec.toUpperCase,
CompressionCodecName.UNCOMPRESSED)
.name())
ParquetRelation.enableLogForwarding()
- ParquetTypesConverter.writeMetaData(attributes, path, conf)
+ // This is a hack. We always set
nullable/containsNull/valueContainsNull to true
+ // for the schema of a parquet data.
+ val schema =
+
DataType.alwaysNullable(StructType.fromAttributes(attributes)).asInstanceOf[StructType]
+ val newAttributes = schema.toAttributes
+ ParquetTypesConverter.writeMetaData(newAttributes, path, conf)
new ParquetRelation(path.toString, Some(conf), sqlContext) {
- override val output = attributes
+ override val output = newAttributes
--- End diff --
Never mind, since we always write nullable data, it should be OK to leave
`ParquetRelation.output` untouched.
---
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]