use of org.apache.avro.file.SeekableInput in project incubator-gobblin by apache.
the class TestAvroExtractor method getRecordFromFile.
public static List<GenericRecord> getRecordFromFile(String path) throws IOException {
Configuration config = new Configuration();
SeekableInput input = new FsInput(new Path(path), config);
DatumReader<GenericRecord> reader1 = new GenericDatumReader<>();
FileReader<GenericRecord> fileReader = DataFileReader.openReader(input, reader1);
List<GenericRecord> records = new ArrayList<>();
for (GenericRecord datum : fileReader) {
records.add(datum);
}
fileReader.close();
return records;
}
Aggregations