public abstract class ArrowReader extends Object implements DictionaryProvider, AutoCloseable
DictionaryProvider.MapDictionaryProvider| Modifier and Type | Field and Description |
|---|---|
protected BufferAllocator |
allocator |
| Modifier | Constructor and Description |
|---|---|
protected |
ArrowReader(BufferAllocator allocator) |
| Modifier and Type | Method and Description |
|---|---|
abstract long |
bytesRead()
Return the number of bytes read from the ReadChannel.
|
void |
close()
Close resources, including vector schema root and dictionary vectors, and the
underlying read source.
|
void |
close(boolean closeReadSource)
Close resources, including vector schema root and dictionary vectors.
|
protected abstract void |
closeReadSource()
Close the underlying read source.
|
protected void |
ensureInitialized()
Initialize if not done previously.
|
Map<Long,Dictionary> |
getDictionaryVectors()
Returns any dictionaries that were loaded along with ArrowRecordBatches.
|
VectorSchemaRoot |
getVectorSchemaRoot()
Returns the vector schema root.
|
protected void |
loadDictionary(ArrowDictionaryBatch dictionaryBatch)
Load an ArrowDictionaryBatch to the readers dictionary vectors.
|
abstract boolean |
loadNextBatch()
Load the next ArrowRecordBatch to the vector schema root if available.
|
protected void |
loadRecordBatch(ArrowRecordBatch batch)
Load an ArrowRecordBatch to the readers VectorSchemaRoot.
|
Dictionary |
lookup(long id)
Lookup a dictionary that has been loaded using the dictionary id.
|
protected void |
prepareLoadNextBatch()
Ensure the reader has been initialized and reset the VectorSchemaRoot row count to 0.
|
protected abstract ArrowDictionaryBatch |
readDictionary()
Read a dictionary batch from the source, will be invoked after the schema has been read and
called N times, where N is the number of dictionaries indicated by the schema Fields.
|
protected abstract Schema |
readSchema()
Read the Schema from the source, will be invoked at the beginning the initialization.
|
protected final BufferAllocator allocator
protected ArrowReader(BufferAllocator allocator)
public VectorSchemaRoot getVectorSchemaRoot() throws IOException
IOException - if reading of schema failspublic Map<Long,Dictionary> getDictionaryVectors() throws IOException
IOException - if reading of schema failspublic Dictionary lookup(long id)
lookup in interface DictionaryProviderid - Unique identifier for a dictionarypublic abstract boolean loadNextBatch()
throws IOException
IOExceptionpublic abstract long bytesRead()
public void close()
throws IOException
close in interface AutoCloseableIOExceptionpublic void close(boolean closeReadSource)
throws IOException
closeReadSource - Flag to control if closing the underlying read sourceIOExceptionprotected abstract void closeReadSource()
throws IOException
IOExceptionprotected abstract Schema readSchema() throws IOException
IOExceptionprotected abstract ArrowDictionaryBatch readDictionary() throws IOException
IOExceptionprotected void ensureInitialized()
throws IOException
IOExceptionprotected void prepareLoadNextBatch()
throws IOException
IOExceptionprotected void loadRecordBatch(ArrowRecordBatch batch)
batch - the record batch to loadprotected void loadDictionary(ArrowDictionaryBatch dictionaryBatch)
dictionaryBatch - Copyright © 2018 The Apache Software Foundation. All rights reserved.