parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetOutputCommitter.java
public static void writeMetaDataFile(Configuration configuration, Path outputPath) {
    JobSummaryLevel level = ParquetOutputFormat.getJobSummaryLevel(configuration);
    if (level == JobSummaryLevel.NONE) {
      return;
    }

    try {
      final FileSystem fileSystem = outputPath.getFileSystem(configuration);
      FileStatus outputStatus = fileSystem.getFileStatus(outputPath);
      List<Footer> footers;

      switch (level) {
        case ALL:
          footers = ParquetFileReader.readAllFootersInParallel(configuration, outputStatus, false); // don't skip row groups
          break;
        case COMMON_ONLY:
          footers = ParquetFileReader.readAllFootersInParallel(configuration, outputStatus, true); // skip row groups
          break;
        default:
          throw new IllegalArgumentException("Unrecognized job summary level: " + level);
      }

      // If there are no footers, _metadata file cannot be written since there is no way to determine schema!
      // Onus of writing any summary files lies with the caller in this case.
      if (footers.isEmpty()) {
        return;
      }

      try {
        ParquetFileWriter.writeMetadataFile(configuration, outputPath, footers, level);
      } catch (Exception e) {
        LOG.warn("could not write summary file(s) for " + outputPath, e);

        final Path metadataPath = new Path(outputPath, ParquetFileWriter.PARQUET_METADATA_FILE);

        try {
          if (fileSystem.exists(metadataPath)) {
            fileSystem.delete(metadataPath, true);
          }
        } catch (Exception e2) {
          LOG.warn("could not delete metadata file" + outputPath, e2);
        }

        try {
          final Path commonMetadataPath = new Path(outputPath, ParquetFileWriter.PARQUET_COMMON_METADATA_FILE);
          if (fileSystem.exists(commonMetadataPath)) {
            fileSystem.delete(commonMetadataPath, true);
          }
        } catch (Exception e2) {
          LOG.warn("could not delete metadata file" + outputPath, e2);
        }

      }
    } catch (Exception e) {
      LOG.warn("could not write summary file for " + outputPath, e);
    }
  }
public static void writeMetaDataFile(Configuration configuration, Path outputPath) {
    JobSummaryLevel level = ParquetOutputFormat.getJobSummaryLevel(configuration);
    if (level == JobSummaryLevel.NONE) {
      return;
    }

    try {
      final FileSystem fileSystem = outputPath.getFileSystem(configuration);
      FileStatus outputStatus = fileSystem.getFileStatus(outputPath);
      List<Footer> footers;

      switch (level) {
        case ALL:
          footers = ParquetFileReader.readAllFootersInParallel(configuration, outputStatus, false); // don't skip row groups
          break;
        case COMMON_ONLY:
          footers = ParquetFileReader.readAllFootersInParallel(configuration, outputStatus, true); // skip row groups
          break;
        default:
          throw new IllegalArgumentException("Unrecognized job summary level: " + level);
      }

      // If there are no footers, _metadata file cannot be written since there is no way to determine schema!
      // Onus of writing any summary files lies with the caller in this case.
      if (footers.isEmpty()) {
        return;
      }

      try {
        ParquetFileWriter.writeMetadataFile(configuration, outputPath, footers, level);
      } catch (Exception e) {
        LOG.warn("could not write summary file(s) for " + outputPath, e);

        final Path metadataPath = new Path(outputPath, ParquetFileWriter.PARQUET_METADATA_FILE);

        try {
          if (fileSystem.exists(metadataPath)) {
            fileSystem.delete(metadataPath, true);
          }
        } catch (Exception e2) {
          LOG.warn("could not delete metadata file" + outputPath, e2);
        }

        try {
          final Path commonMetadataPath = new Path(outputPath, ParquetFileWriter.PARQUET_COMMON_METADATA_FILE);
          if (fileSystem.exists(commonMetadataPath)) {
            fileSystem.delete(commonMetadataPath, true);
          }
        } catch (Exception e2) {
          LOG.warn("could not delete metadata file" + outputPath, e2);
        }

      }
    } catch (Exception e) {
      LOG.warn("could not write summary file for " + outputPath, e);
    }
  }
public static void writeMetaDataFile ( Configuration configuration , Path outputPath ) { JobSummaryLevel level = ParquetOutputFormat . getJobSummaryLevel ( configuration ) ; if ( level == JobSummaryLevel . NONE ) { return ; } try { final FileSystem fileSystem = outputPath . getFileSystem ( configuration ) ; FileStatus outputStatus = fileSystem . getFileStatus ( outputPath ) ; List < Footer > footers ; switch ( level ) { case ALL : footers = ParquetFileReader . readAllFootersInParallel ( configuration , outputStatus , false ) ; // don't skip row groups break ; case COMMON_ONLY : footers = ParquetFileReader . readAllFootersInParallel ( configuration , outputStatus , true ) ; // skip row groups break ; default : throw new IllegalArgumentException ( "Unrecognized job summary level: " + level ) ; } // If there are no footers, _metadata file cannot be written since there is no way to determine schema! // Onus of writing any summary files lies with the caller in this case. if ( footers . isEmpty ( ) ) { return ; } try { ParquetFileWriter . writeMetadataFile ( configuration , outputPath , footers , level ) ; } catch ( Exception e ) { LOG . warn ( "could not write summary file(s) for " + outputPath , e ) ; final Path metadataPath = new Path ( outputPath , ParquetFileWriter . PARQUET_METADATA_FILE ) ; try { if ( fileSystem . exists ( metadataPath ) ) { fileSystem . delete ( metadataPath , true ) ; } } catch ( Exception e2 ) { LOG . warn ( "could not delete metadata file" + outputPath , e2 ) ; } try { final Path commonMetadataPath = new Path ( outputPath , ParquetFileWriter . PARQUET_COMMON_METADATA_FILE ) ; if ( fileSystem . exists ( commonMetadataPath ) ) { fileSystem . delete ( commonMetadataPath , true ) ; } } catch ( Exception e2 ) { LOG . warn ( "could not delete metadata file" + outputPath , e2 ) ; } } } catch ( Exception e ) { LOG . warn ( "could not write summary file for " + outputPath , e ) ; } }
TODO: all the catching of Exceptions below -- see PARQUET-383
TODO : all the catching of Exceptions below -- see PARQUET - 383