Class RowRanges.Builder
java.lang.Object
org.apache.parquet.filter2.columnindex.RowRanges.Builder
- Enclosing class:
- RowRanges
Constructs a
RowRanges by appending selected row indices in strictly increasing
order. Consecutive indices are coalesced into a single RowRanges.Range; gaps close the
current run and start a new one.
Usage:
RowRanges.Builder builder = RowRanges.builder();
for (long row : selectedRowsInOrder) {
builder.addSelectedRow(row);
}
RowRanges ranges = builder.build();
-
Method Summary
Modifier and TypeMethodDescriptionaddSelectedRange(long from, long to) Marks the inclusive range[from, to]of 0-based row indices as selected.addSelectedRow(long rowIndex) MarksrowIndexas selected.build()Returns a snapshot of the rows selected so far.
-
Method Details
-
addSelectedRow
MarksrowIndexas selected. The value is a 0-based row index within the current row group. Must be called in strictly increasing order; calling with a value less than or equal to the previous call's value throwsIllegalArgumentException.- Parameters:
rowIndex- the 0-based row index to mark selected (must be>the last value passed and non-negative)- Returns:
- this builder for chaining
-
addSelectedRange
Marks the inclusive range[from, to]of 0-based row indices as selected. Ranges must be appended in strictly increasing order:frommust be greater than the last selected row index. A range directly adjacent to the current run (wherefromis exactly one past the previousto) is coalesced into a singleRowRanges.Range; a gap closes the current run and starts a new one.- Parameters:
from- the first 0-based row index of the range (inclusive; must be>the last selected row index and non-negative)to- the last 0-based row index of the range (inclusive; must be>=from)- Returns:
- this builder for chaining
-
build
Returns a snapshot of the rows selected so far. The returnedRowRangesis independent of this builder, so the builder may continue to be used afterwards without affecting it.- Returns:
- the constructed
RowRanges, orRowRanges.EMPTYwhen no rows were selected.
-