Class ParquetFileReader.RowReaderBuilder
- Enclosing class:
ParquetFileReader
Builds a RowReader with optional projection, filter, and head/tail
row limit.
Obtained from ParquetFileReader.buildRowReader(). Each setter returns
the builder for chaining; build() consumes the configuration and
creates the reader. The builder is not reusable after build().
RowReader reader = file.buildRowReader()
.projection(ColumnProjection.columns("id", "name"))
.filter(FilterPredicate.eq("status", "active"))
.head(1000)
.build();
-
Method Summary
Modifier and TypeMethodDescriptionbuild()filter(FilterPredicate filter) Apply a row-group / record-level filter predicate.firstRow(long firstRow) Begin reading from the given absolute row index.head(long maxRows) Limit to the firstmaxRowsrows.projection(ColumnProjection projection) Restrict reading to the given columns.tail(long tailRows) Limit to the lasttailRowsrows.
-
Method Details
-
projection
Restrict reading to the given columns. Default: all columns. -
filter
Apply a row-group / record-level filter predicate. Default: no filter. -
head
Limit to the firstmaxRowsrows. Mutually exclusive withtail(long). -
tail
Limit to the lasttailRowsrows. Row groups that do not overlap the tail are skipped entirely, so pages for earlier row groups are never fetched or decoded — useful on remote backends. Mutually exclusive withhead(long),filter, andfirstRow. Single-file only. -
firstRow
Begin reading from the given absolute row index. Earlier row groups are not opened — their pages are not fetched or decoded — so this is an O(1 RG) seek on remote backends, in contrast to walking
next()from row 0.Cost within the target row group. The reader still yields rows from the row group's first row, then walks
next()firstRow - rowGroupFirstRowtimes to discard the leading residue. Those residue rows are decoded —firstRownear the end of a 1 M-row group walks ~1 M decodednext()calls. Page-level skip via OffsetIndex is tracked as #381.firstRow == 0is the no-op default.firstRow == totalRowsproduces an empty reader.firstRow > totalRowsthrowsIllegalArgumentExceptionatbuild()time. Indexes into the first file's rows for multi-file readers; cross-filefirstRowis out of scope. Mutually exclusive withtail(long); composes withhead(long)for a bounded[firstRow, firstRow + maxRows)window. -
build
-