use of org.apache.parquet.hadoop.metadata.ParquetMetadata in project alluxio by Alluxio.
the class ParquetReader method create.
/**
* Creates a parquet reader.
*
* @param uri the URI to the input
* @return the reader
* @throws IOException when failed to create the reader
*/
public static ParquetReader create(AlluxioURI uri) throws IOException {
Path inputPath = new JobPath(uri.getScheme(), uri.getAuthority().toString(), uri.getPath());
Configuration conf = ReadWriterUtils.readNoCacheConf();
InputFile inputFile = HadoopInputFile.fromPath(inputPath, conf);
org.apache.parquet.hadoop.ParquetReader<Record> reader = AvroParquetReader.<Record>builder(inputFile).disableCompatibility().withDataModel(GenericData.get()).withConf(conf).build();
Schema schema;
ParquetMetadata footer;
try (ParquetFileReader r = new ParquetFileReader(inputFile, ParquetReadOptions.builder().build())) {
footer = r.getFooter();
schema = new AvroSchemaConverter().convert(footer.getFileMetaData().getSchema());
}
return new ParquetReader(reader, schema, footer);
}
Aggregations