Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10972#discussion_r51218082
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRelation.scala
 ---
    @@ -799,9 +799,31 @@ 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 {
    +            val pathsAndSchemata = footers.map { footer =>
    +              footer.getFile -> 
ParquetRelation.readSchemaFromFooter(footer, converter)
    +            }
    +
    +            pathsAndSchemata.foldLeft(StructType(Nil)) { case 
(mergedSoFar, (file, schema)) =>
    +              try {
    +                mergedSoFar.merge(schema)
    +              } catch {
    +                case cause: Throwable =>
    +                  throw new SparkException(
    +                    s"""Failed merging schema of file $file:
    --- End diff --
    
    Failed to merge


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to