CloseableIterable<ManifestEntry> entries(Collection<String> columns) {
if (entries != null) {
return CloseableIterable.withNoopClose(entries);
}
FileFormat format = FileFormat.fromFileName(file.location());
Preconditions.checkArgument(format != null, "Unable to determine format of manifest: " + file);
Schema schema = ManifestEntry.projectSchema(spec.partitionType(), columns);
switch (format) {
case AVRO:
AvroIterable<ManifestEntry> reader = Avro.read(file)
.project(schema)
.rename("manifest_entry", ManifestEntry.class.getName())
.rename("partition", PartitionData.class.getName())
.rename("r102", PartitionData.class.getName())
.rename("data_file", GenericDataFile.class.getName())
.rename("r2", GenericDataFile.class.getName())
.reuseContainers()
.build();
addCloseable(reader);
return reader;
default:
throw new UnsupportedOperationException("Invalid format for manifest file: " + format);
}
}