java.lang.Object
org.apache.arrow.vector.ipc.JsonFileReader
- All Implemented Interfaces:
AutoCloseable,DictionaryProvider
A reader for JSON files that translates them into vectors. This reader is used for integration
tests.
This class uses a streaming parser API, method naming tends to reflect this implementation detail.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.arrow.vector.dictionary.DictionaryProvider
DictionaryProvider.MapDictionaryProvider -
Constructor Summary
ConstructorsConstructorDescriptionJsonFileReader(File inputFile, BufferAllocator allocator) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Get all dictionary IDs.lookup(long id) Return the dictionary for the given ID.read()Returns the next record batch from the file.booleanread(VectorSchemaRoot root) Reads the next record batch from the file intoroot.intskip(int numBatches) Skips a number of record batches in the file.start()Reads the beginning (schema section) of the json file and returns it.
-
Constructor Details
-
JsonFileReader
public JsonFileReader(File inputFile, BufferAllocator allocator) throws com.fasterxml.jackson.core.JsonParseException, IOException Constructs a new instance.- Parameters:
inputFile- The file to read.allocator- The allocator to use for allocating buffers.- Throws:
com.fasterxml.jackson.core.JsonParseExceptionIOException
-
-
Method Details
-
lookup
Description copied from interface:DictionaryProviderReturn the dictionary for the given ID.- Specified by:
lookupin interfaceDictionaryProvider
-
getDictionaryIds
Description copied from interface:DictionaryProviderGet all dictionary IDs.- Specified by:
getDictionaryIdsin interfaceDictionaryProvider
-
start
Reads the beginning (schema section) of the json file and returns it.- Throws:
com.fasterxml.jackson.core.JsonParseExceptionIOException
-
read
Reads the next record batch from the file intoroot.- Throws:
IOException
-
read
Returns the next record batch from the file.- Throws:
IOException
-
skip
Skips a number of record batches in the file.- Parameters:
numBatches- the number of batches to skip- Returns:
- the actual number of skipped batches.
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-