Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/10972#discussion_r51221351
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRelation.scala
---
@@ -799,9 +799,26 @@ private[sql] object ParquetRelation extends Logging {
assumeInt96IsTimestamp = assumeInt96IsTimestamp,
writeLegacyParquetFormat = writeLegacyParquetFormat)
- footers.map { footer =>
- ParquetRelation.readSchemaFromFooter(footer, converter)
- }.reduceLeftOption(_ merge _).iterator
+ if (footers.isEmpty) {
+ Iterator.empty
+ } else {
+ var mergedSchema = StructType(Nil)
+ footers.foreach { footer =>
+ val schema = ParquetRelation.readSchemaFromFooter(footer,
converter)
+ try {
+ mergedSchema = mergedSchema.merge(schema)
--- End diff --
Can we get the schema from first footer and then go through this loop for
remaining footers? Because you merge the first schema with an empty schema, I
think the all fields in merged schema will be optional in their metadata. So
the pushing down of filters will not normally work.
---
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]