Package org.apache.arrow.vector.ipc
Class ArrowFileReader
java.lang.Object
org.apache.arrow.vector.ipc.ArrowReader
org.apache.arrow.vector.ipc.ArrowFileReader
- All Implemented Interfaces:
AutoCloseable
,DictionaryProvider
An implementation of
ArrowReader
that reads the standard arrow binary file format.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.arrow.vector.dictionary.DictionaryProvider
DictionaryProvider.MapDictionaryProvider
-
Field Summary
Fields inherited from class org.apache.arrow.vector.ipc.ArrowReader
allocator, dictionaries
-
Constructor Summary
ConstructorDescriptionArrowFileReader
(SeekableByteChannel in, BufferAllocator allocator) ArrowFileReader
(SeekableByteChannel in, BufferAllocator allocator, CompressionCodec.Factory compressionFactory) ArrowFileReader
(SeekableReadChannel in, BufferAllocator allocator) ArrowFileReader
(SeekableReadChannel in, BufferAllocator allocator, CompressionCodec.Factory compressionFactory) -
Method Summary
Modifier and TypeMethodDescriptionlong
Return the number of bytes read from the ReadChannel.protected void
Close the underlying read source.Get custom metadata.Returns theArrowBlock
metadata from the file.void
Reads the schema and initializes the vectors.boolean
Returns true if a batch was read, false if no more batches.boolean
loadRecordBatch
(ArrowBlock block) Loads record batch for the given block.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 Schema
Read the Schema from the source, will be invoked at the beginning the initialization.Methods inherited from class org.apache.arrow.vector.ipc.ArrowReader
close, close, ensureInitialized, getDictionaryIds, getDictionaryVectors, getVectorSchemaRoot, loadDictionary, loadRecordBatch, lookup, prepareLoadNextBatch
-
Constructor Details
-
ArrowFileReader
public ArrowFileReader(SeekableReadChannel in, BufferAllocator allocator, CompressionCodec.Factory compressionFactory) -
ArrowFileReader
public ArrowFileReader(SeekableByteChannel in, BufferAllocator allocator, CompressionCodec.Factory compressionFactory) -
ArrowFileReader
-
ArrowFileReader
-
-
Method Details
-
bytesRead
public long bytesRead()Description copied from class:ArrowReader
Return the number of bytes read from the ReadChannel.- Specified by:
bytesRead
in classArrowReader
- Returns:
- number of bytes read
-
closeReadSource
Description copied from class:ArrowReader
Close the underlying read source.- Specified by:
closeReadSource
in classArrowReader
- Throws:
IOException
- on error
-
readSchema
Description copied from class:ArrowReader
Read the Schema from the source, will be invoked at the beginning the initialization.- Specified by:
readSchema
in classArrowReader
- Returns:
- the read Schema
- Throws:
IOException
- on error
-
initialize
Description copied from class:ArrowReader
Reads the schema and initializes the vectors.- Overrides:
initialize
in classArrowReader
- Throws:
IOException
-
getMetaData
Get custom metadata. -
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.- Returns:
- the read ArrowDictionaryBatch
- Throws:
IOException
- on error
-
loadNextBatch
Returns true if a batch was read, false if no more batches.- Specified by:
loadNextBatch
in classArrowReader
- Returns:
- true if a batch was read, false on EOS
- Throws:
IOException
- on error
-
getDictionaryBlocks
- Throws:
IOException
-
getRecordBlocks
Returns theArrowBlock
metadata from the file.- Throws:
IOException
-
loadRecordBatch
Loads record batch for the given block.- Throws:
IOException
-