private static DataWriter<StructLike> dataWriter(Schema dataSchema, OutputFile outputFile)
      throws IOException {
    FileFormat fileFormat = fileFormat(outputFile.location());
    switch (fileFormat) {
      case AVRO:
        return Avro.writeData(outputFile)
            .schema(dataSchema)
            .createWriterFunc(InternalWriter::create)
            .overwrite()
            .withSpec(PartitionSpec.unpartitioned())
            .build();
      case PARQUET:
      case ORC:
        // Internal writers are not supported for PARQUET & ORC yet.
      default:
        throw new UnsupportedOperationException("Unsupported file format:" + fileFormat.name());
    }
  }
Reads partition statistics from the specified {@link InputFile} using given schema.

@param schema The {@link Schema} of the partition statistics file.
@param inputFile An {@link InputFile} pointing to the partition stats file.
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/data/PartitionStatsHandler.java