Interface RowReader
- All Superinterfaces:
AutoCloseable, Closeable, FieldAccessor, StructAccessor
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.rowReader()) {
while (rowReader.hasNext()) {
rowReader.next();
long id = rowReader.getLong("id");
PqStruct address = rowReader.getStruct("address");
String city = address.getString("city");
}
}
-
Method Summary
Methods inherited from interface FieldAccessor
getBinary, getBoolean, getDate, getDecimal, getDouble, getFieldCount, getFieldName, getFloat, getInt, getInterval, getLocalTimestamp, getLong, getRawValue, getString, getTime, getTimestamp, getUuid, getValue, getVariant, isNullMethods inherited from interface StructAccessor
getBinary, getBoolean, getDate, getDecimal, getDouble, getFloat, getInt, getInterval, getList, getList, getLocalTimestamp, getLong, getMap, getMap, getRawValue, getString, getStruct, getStruct, getTime, getTimestamp, getUuid, getValue, getVariant, isNull
-
Method Details
-
hasNext
Check if there are more rows to read.
Reaches the file when the current batch runs out, so it can fail the way any read can.
- Returns:
- true if there are more rows available
- Throws:
IOException- if the bytes could not be readParquetReadException- if the file's bytes are not what a Parquet file can say: a footer or a page index that will not parse, a dictionary page the metadata places outside its column chunk, a page whose checksum fails, values that do not decode under the encoding declared for them. In a multi-file read this covers a later file that is not Parquet at all, or whose schema cannot be reconciled with the first file's
-
next
Advance to the next row. Must be called before accessing row data. CallhasNext()before everynext():next()does not load rows itself.- Throws:
NoSuchElementException- if no row is available tonext()without a precedinghasNext(): at the end of the current batch, or on a filtered read whenhasNext()has not selected the next matching rowIOException- if the bytes could not be readParquetReadException- if the file's bytes are not what a Parquet file can say: a footer or a page index that will not parse, a dictionary page the metadata places outside its column chunk, a page whose checksum fails, values that do not decode under the encoding declared for them. In a multi-file read this covers a later file that is not Parquet at all, or whose schema cannot be reconciled with the first file's
-
close
Releases the resources held by this reader. Idempotent: calling it more than once has no further effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if a file this reader owns could not be closed
-