use of org.apache.arrow.vector.ipc.ArrowFileReader in project twister2 by DSC-SPIDAL.
the class Twister2ArrowFileReader method initInputFile.
public void initInputFile() {
try {
LOG.info("arrow schema:" + Schema.fromJSON(arrowSchema));
Path path = new Path(arrowInputFile);
this.fileSystem = FileSystemUtils.get(path);
this.fsDataInputStream = fileSystem.open(path);
this.fileInputStream = new FileInputStream(arrowInputFile);
this.arrowFileReader = new ArrowFileReader(new SeekableReadChannel(fileInputStream.getChannel()), rootAllocator);
this.root = arrowFileReader.getVectorSchemaRoot();
arrowBlocks = arrowFileReader.getRecordBlocks();
LOG.info("\nReading the arrow file : " + arrowInputFile + "\tFile size:" + arrowInputFile.length() + "\tschema:" + root.getSchema().toString() + "\tArrow Blocks Size: " + arrowBlocks.size());
} catch (FileNotFoundException e) {
throw new Twister2RuntimeException("File Not Found", e);
} catch (Exception ioe) {
throw new Twister2RuntimeException("IOException Occured", ioe);
}
}
Aggregations