Package org.apache.arrow.vector.ipc
Class JsonFileReader
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
ConstructorDescriptionJsonFileReader
(File inputFile, BufferAllocator allocator) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Get all dictionary IDs.lookup
(long id) Return the dictionary for the given ID.read()
Returns the next record batch from the file.boolean
read
(VectorSchemaRoot root) Reads the next record batch from the file intoroot
.int
skip
(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.JsonParseException
IOException
-
-
Method Details
-
lookup
Description copied from interface:DictionaryProvider
Return the dictionary for the given ID.- Specified by:
lookup
in interfaceDictionaryProvider
-
getDictionaryIds
Description copied from interface:DictionaryProvider
Get all dictionary IDs.- Specified by:
getDictionaryIds
in interfaceDictionaryProvider
-
start
Reads the beginning (schema section) of the json file and returns it.- Throws:
com.fasterxml.jackson.core.JsonParseException
IOException
-
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:
close
in interfaceAutoCloseable
- Throws:
IOException
-