Interface RowReader
- All Superinterfaces:
AutoCloseable, StructAccessor
- All Known Implementing Classes:
MultiFileRowReader
Provides row-oriented iteration over a Parquet file.
A RowReader is a stateful, mutable view providing access to the current row
in the iterator. The values returned by its accessors change between calls of next().
Usage example:
try (RowReader rowReader = fileReader.createRowReader()) {
while (rowReader.hasNext()) {
rowReader.next();
long id = rowReader.getLong("id");
PqStruct address = rowReader.getStruct("address");
String city = address.getString("city");
}
}
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()byte[]getBinary(int fieldIndex) Get a BINARY field value by field index.booleangetBoolean(int fieldIndex) Get a BOOLEAN field value by field index.getDate(int fieldIndex) Get a DATE field value by field index.getDecimal(int fieldIndex) Get a DECIMAL field value by field index.doublegetDouble(int fieldIndex) Get a DOUBLE field value by field index.floatgetFloat(int fieldIndex) Get a FLOAT field value by field index.intgetInt(int fieldIndex) Get an INT32 field value by field index.getList(int fieldIndex) Get a LIST field value by field index.getListOfDoubles(int fieldIndex) Get a DOUBLE list field by field index.getListOfInts(int fieldIndex) Get an INT32 list field by field index.getListOfLongs(int fieldIndex) Get an INT64 list field by field index.longgetLong(int fieldIndex) Get an INT64 field value by field index.getMap(int fieldIndex) Get a MAP field value by field index.getString(int fieldIndex) Get a STRING field value by field index.getStruct(int fieldIndex) Get a nested struct field value by field index.getTime(int fieldIndex) Get a TIME field value by field index.getTimestamp(int fieldIndex) Get a TIMESTAMP field value by field index.getUuid(int fieldIndex) Get a UUID field value by field index.getValue(int fieldIndex) Get a field value by field index without type conversion.booleanhasNext()Check if there are more rows to read.booleanisNull(int fieldIndex) Check if a field is null by field index.voidnext()Advance to the next row.Methods inherited from interface StructAccessor
getBinary, getBoolean, getDate, getDecimal, getDouble, getFieldCount, getFieldName, getFloat, getInt, getList, getListOfDoubles, getListOfInts, getListOfLongs, getLong, getMap, getString, getStruct, getTime, getTimestamp, getUuid, getValue, isNull
-
Method Details
-
hasNext
boolean hasNext()Check if there are more rows to read.- Returns:
- true if there are more rows available
-
next
void next()Advance to the next row. Must be called before accessing row data.- Throws:
NoSuchElementException- if no more rows are available
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-
getInt
int getInt(int fieldIndex) Get an INT32 field value by field index.- Throws:
NullPointerException- if the field is null
-
getLong
long getLong(int fieldIndex) Get an INT64 field value by field index.- Throws:
NullPointerException- if the field is null
-
getFloat
float getFloat(int fieldIndex) Get a FLOAT field value by field index.- Throws:
NullPointerException- if the field is null
-
getDouble
double getDouble(int fieldIndex) Get a DOUBLE field value by field index.- Throws:
NullPointerException- if the field is null
-
getBoolean
boolean getBoolean(int fieldIndex) Get a BOOLEAN field value by field index.- Throws:
NullPointerException- if the field is null
-
getString
Get a STRING field value by field index.- Returns:
- the string value, or null if the field is null
-
getBinary
byte[] getBinary(int fieldIndex) Get a BINARY field value by field index.- Returns:
- the binary value, or null if the field is null
-
getDate
Get a DATE field value by field index.- Returns:
- the date value, or null if the field is null
-
getTime
Get a TIME field value by field index.- Returns:
- the time value, or null if the field is null
-
getTimestamp
Get a TIMESTAMP field value by field index.- Returns:
- the timestamp value, or null if the field is null
-
getDecimal
Get a DECIMAL field value by field index.- Returns:
- the decimal value, or null if the field is null
-
getUuid
Get a UUID field value by field index.- Returns:
- the UUID value, or null if the field is null
-
getStruct
Get a nested struct field value by field index.- Returns:
- the struct value, or null if the field is null
-
getListOfInts
Get an INT32 list field by field index.- Returns:
- the list, or null if the field is null
-
getListOfLongs
Get an INT64 list field by field index.- Returns:
- the list, or null if the field is null
-
getListOfDoubles
Get a DOUBLE list field by field index.- Returns:
- the list, or null if the field is null
-
getList
Get a LIST field value by field index.- Returns:
- the list, or null if the field is null
-
getMap
Get a MAP field value by field index.- Returns:
- the map, or null if the field is null
-
getValue
Get a field value by field index without type conversion.- Returns:
- the raw value, or null if the field is null
-
isNull
boolean isNull(int fieldIndex) Check if a field is null by field index.
-