Class MultiFileRowReader
java.lang.Object
dev.hardwood.reader.MultiFileRowReader
- All Implemented Interfaces:
RowReader, StructAccessor, AutoCloseable
A RowReader that reads across multiple Parquet files with automatic file prefetching.
This reader uses a FileManager to handle file lifecycle and prefetching.
The next file is automatically prepared while reading the current file, minimizing
latency at file boundaries.
Usage:
try (Hardwood hardwood = Hardwood.create();
MultiFileParquetReader parquet = hardwood.openAll(files);
MultiFileRowReader reader = parquet.createRowReader()) {
while (reader.hasNext()) {
reader.next();
// access data using same API as RowReader
}
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected booleanprotected dev.hardwood.internal.reader.BatchDataViewprotected booleanprotected dev.hardwood.internal.predicate.ResolvedPredicateprotected booleanprotected longprotected ProjectedSchemaprotected int -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()byte[]getBinary(int columnIndex) Get a BINARY field value by field index.byte[]Get a BINARY field value by name.booleangetBoolean(int columnIndex) Get a BOOLEAN field value by field index.booleangetBoolean(String name) Get a BOOLEAN field value by name.getDate(int columnIndex) Get a DATE field value by field index.Get a DATE field value by name.getDecimal(int columnIndex) Get a DECIMAL field value by field index.getDecimal(String name) Get a DECIMAL field value by name.doublegetDouble(int columnIndex) Get a DOUBLE field value by field index.doubleGet a DOUBLE field value by name.intGet the number of fields in this struct.getFieldName(int index) Get the name of a field by index.floatgetFloat(int columnIndex) Get a FLOAT field value by field index.floatGet a FLOAT field value by name.intgetInt(int columnIndex) Get an INT32 field value by field index.intGet an INT32 field value by name.getList(int columnIndex) Get a LIST field value by field index.Get a LIST field value by name.getListOfDoubles(int columnIndex) Get a DOUBLE list field by field index.getListOfDoubles(String name) Get a DOUBLE list field by name.getListOfInts(int columnIndex) Get an INT32 list field by field index.getListOfInts(String name) Get an INT32 list field by name.getListOfLongs(int columnIndex) Get an INT64 list field by field index.getListOfLongs(String name) Get an INT64 list field by name.longgetLong(int columnIndex) Get an INT64 field value by field index.longGet an INT64 field value by name.getMap(int columnIndex) Get a MAP field value by field index.Get a MAP field value by name.getString(int columnIndex) Get a STRING field value by field index.Get a STRING field value by name.getStruct(int columnIndex) Get a nested struct field value by field index.Get a nested struct field value by name.getTime(int columnIndex) Get a TIME field value by field index.Get a TIME field value by name.getTimestamp(int columnIndex) Get a TIMESTAMP field value by field index.getTimestamp(String name) Get a TIMESTAMP field value by name.getUuid(int columnIndex) Get a UUID field value by field index.Get a UUID field value by name.getValue(int columnIndex) Get a field value by field index without type conversion.Get a field value by name without type conversion.booleanhasNext()Check if there are more rows to read.protected voidEnsures the reader is initialized.booleanisNull(int columnIndex) Check if a field is null by field index.booleanCheck if a field is null by name.protected booleanLoads the next batch of data.voidnext()Advance to the next row.
-
Field Details
-
dataView
protected dev.hardwood.internal.reader.BatchDataView dataView -
filterPredicate
protected dev.hardwood.internal.predicate.ResolvedPredicate filterPredicate -
projectedSchemaRef
-
rowIndex
protected int rowIndex -
batchSize
protected int batchSize -
exhausted
protected boolean exhausted -
closed
protected volatile boolean closed -
initialized
protected boolean initialized -
maxRows
protected long maxRows
-
-
Method Details
-
initialize
protected void initialize()Ensures the reader is initialized. Called by metadata methods that may be invoked before iteration starts. -
loadNextBatch
protected boolean loadNextBatch()Loads the next batch of data.- Returns:
- true if a batch was loaded, false if no more data
-
close
public void close() -
hasNext
-
next
-
getInt
Description copied from interface:StructAccessorGet an INT32 field value by name.- Specified by:
getIntin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the int value
-
getInt
-
getLong
Description copied from interface:StructAccessorGet an INT64 field value by name.- Specified by:
getLongin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the long value
-
getLong
-
getFloat
Description copied from interface:StructAccessorGet a FLOAT field value by name.- Specified by:
getFloatin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the float value
-
getFloat
-
getDouble
Description copied from interface:StructAccessorGet a DOUBLE field value by name.- Specified by:
getDoublein interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the double value
-
getDouble
-
getBoolean
Description copied from interface:StructAccessorGet a BOOLEAN field value by name.- Specified by:
getBooleanin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the boolean value
-
getBoolean
public boolean getBoolean(int columnIndex) Description copied from interface:RowReaderGet a BOOLEAN field value by field index.- Specified by:
getBooleanin interfaceRowReader
-
getString
Description copied from interface:StructAccessorGet a STRING field value by name.- Specified by:
getStringin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the string value, or null if the field is null
-
getString
-
getBinary
Description copied from interface:StructAccessorGet a BINARY field value by name.- Specified by:
getBinaryin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the byte array, or null if the field is null
-
getBinary
-
getDate
Description copied from interface:StructAccessorGet a DATE field value by name.- Specified by:
getDatein interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the date value, or null if the field is null
-
getDate
-
getTime
Description copied from interface:StructAccessorGet a TIME field value by name.- Specified by:
getTimein interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the time value, or null if the field is null
-
getTime
-
getTimestamp
Description copied from interface:StructAccessorGet a TIMESTAMP field value by name.- Specified by:
getTimestampin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the instant value, or null if the field is null
-
getTimestamp
Description copied from interface:RowReaderGet a TIMESTAMP field value by field index.- Specified by:
getTimestampin interfaceRowReader- Returns:
- the timestamp value, or null if the field is null
-
getDecimal
Description copied from interface:StructAccessorGet a DECIMAL field value by name.- Specified by:
getDecimalin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the decimal value, or null if the field is null
-
getDecimal
Description copied from interface:RowReaderGet a DECIMAL field value by field index.- Specified by:
getDecimalin interfaceRowReader- Returns:
- the decimal value, or null if the field is null
-
getUuid
Description copied from interface:StructAccessorGet a UUID field value by name.- Specified by:
getUuidin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the UUID value, or null if the field is null
-
getUuid
-
getStruct
Description copied from interface:StructAccessorGet a nested struct field value by name.- Specified by:
getStructin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the nested struct, or null if the field is null
-
getListOfInts
Description copied from interface:StructAccessorGet an INT32 list field by name.- Specified by:
getListOfIntsin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the int list, or null if the field is null
-
getListOfLongs
Description copied from interface:StructAccessorGet an INT64 list field by name.- Specified by:
getListOfLongsin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the long list, or null if the field is null
-
getListOfDoubles
Description copied from interface:StructAccessorGet a DOUBLE list field by name.- Specified by:
getListOfDoublesin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the double list, or null if the field is null
-
getList
Description copied from interface:StructAccessorGet a LIST field value by name.- Specified by:
getListin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the list, or null if the field is null
-
getMap
Description copied from interface:StructAccessorGet a MAP field value by name.- Specified by:
getMapin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the map, or null if the field is null
-
getStruct
-
getListOfInts
Description copied from interface:RowReaderGet an INT32 list field by field index.- Specified by:
getListOfIntsin interfaceRowReader- Returns:
- the list, or null if the field is null
-
getListOfLongs
Description copied from interface:RowReaderGet an INT64 list field by field index.- Specified by:
getListOfLongsin interfaceRowReader- Returns:
- the list, or null if the field is null
-
getListOfDoubles
Description copied from interface:RowReaderGet a DOUBLE list field by field index.- Specified by:
getListOfDoublesin interfaceRowReader- Returns:
- the list, or null if the field is null
-
getList
-
getMap
-
getValue
Description copied from interface:StructAccessorGet a field value by name without type conversion. Returns the raw value as stored internally.- Specified by:
getValuein interfaceStructAccessor- Parameters:
name- the field name- Returns:
- the raw value, or null if the field is null
-
getValue
-
isNull
Description copied from interface:StructAccessorCheck if a field is null by name.- Specified by:
isNullin interfaceStructAccessor- Parameters:
name- the field name- Returns:
- true if the field is null
-
isNull
-
getFieldCount
public int getFieldCount()Description copied from interface:StructAccessorGet the number of fields in this struct.- Specified by:
getFieldCountin interfaceStructAccessor- Returns:
- the field count
-
getFieldName
Description copied from interface:StructAccessorGet the name of a field by index.- Specified by:
getFieldNamein interfaceStructAccessor- Parameters:
index- the field index (0-based)- Returns:
- the field name
-