public class JsonFileReader extends Object implements AutoCloseable, DictionaryProvider
This class uses a streaming parser API, method naming tends to reflect this implementation detail.
DictionaryProvider.MapDictionaryProvider| Constructor and Description |
|---|
JsonFileReader(File inputFile,
BufferAllocator allocator)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Set<Long> |
getDictionaryIds()
Get all dictionary IDs.
|
Dictionary |
lookup(long id)
Return the dictionary for the given ID.
|
VectorSchemaRoot |
read()
Returns the next record batch from the file.
|
boolean |
read(VectorSchemaRoot root)
Reads the next record batch from the file into
root. |
int |
skip(int numBatches)
Skips a number of record batches in the file.
|
Schema |
start()
Reads the beginning (schema section) of the json file and returns it.
|
public JsonFileReader(File inputFile, BufferAllocator allocator) throws com.fasterxml.jackson.core.JsonParseException, IOException
inputFile - The file to read.allocator - The allocator to use for allocating buffers.com.fasterxml.jackson.core.JsonParseExceptionIOExceptionpublic Dictionary lookup(long id)
DictionaryProviderlookup in interface DictionaryProviderpublic Set<Long> getDictionaryIds()
DictionaryProvidergetDictionaryIds in interface DictionaryProviderpublic Schema start() throws com.fasterxml.jackson.core.JsonParseException, IOException
com.fasterxml.jackson.core.JsonParseExceptionIOExceptionpublic boolean read(VectorSchemaRoot root) throws IOException
root.IOExceptionpublic VectorSchemaRoot read() throws IOException
IOExceptionpublic int skip(int numBatches)
throws IOException
numBatches - the number of batches to skipIOExceptionpublic void close()
throws IOException
close in interface AutoCloseableIOExceptionCopyright © 2024 The Apache Software Foundation. All rights reserved.