Class RowRanges
java.lang.Object
org.apache.parquet.filter2.columnindex.RowRanges
- Direct Known Subclasses:
RowRanges
Class representing row ranges in a row-group. These row ranges are calculated as a result of the column index based
filtering. To be used iterate over the matching row indexes to be read from a row-group, retrieve the count of the
matching rows or check overlapping of a row index range.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classConstructs aRowRangesby appending selected row indices in strictly increasing order.static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RowRanges.Builderbuilder()static RowRangescreateSingle(long rowCount) Creates an immutable RowRanges object with the single range [0, rowCount - 1].static RowRangesintersection(RowRanges left, RowRanges right) Calculates the intersection of the two specified RowRanges object.booleanisOverlapping(long from, long to) iterator()longrowCount()toString()static RowRangesCalculates the union of the two specified RowRanges object.
-
Field Details
-
EMPTY
-
-
Constructor Details
-
RowRanges
protected RowRanges()
-
-
Method Details
-
createSingle
Creates an immutable RowRanges object with the single range [0, rowCount - 1].- Parameters:
rowCount- a single row count- Returns:
- an immutable RowRanges
-
union
Calculates the union of the two specified RowRanges object. The union of two range is calculated if there are no elements between them. Otherwise, the two disjunct ranges are stored separately.For example: [113, 241] ∪ [221, 340] = [113, 340] [113, 230] ∪ [231, 340] = [113, 340] while [113, 230] ∪ [232, 340] = [113, 230], [232, 340]
The result RowRanges object will contain all the row indexes that were contained in one of the specified objects.- Parameters:
left- left RowRangesright- right RowRanges- Returns:
- a mutable RowRanges contains all the row indexes that were contained in one of the specified objects
-
intersection
Calculates the intersection of the two specified RowRanges object. Two ranges intersect if they have common elements otherwise the result is empty.For example: [113, 241] ∩ [221, 340] = [221, 241] while [113, 230] ∩ [231, 340] = <EMPTY>
- Parameters:
left- left RowRangesright- right RowRanges- Returns:
- a mutable RowRanges contains all the row indexes that were contained in both of the specified objects
-
rowCount
public long rowCount()- Returns:
- the number of rows in the ranges
-
iterator
- Returns:
- the ascending iterator of the row indexes contained in the ranges
-
isOverlapping
public boolean isOverlapping(long from, long to) - Parameters:
from- the first row of the range to be checked for connectionto- the last row of the range to be checked for connection- Returns:
trueif the specified range is overlapping (have common elements) with one of the ranges
-
getRanges
-
toString
-
builder
- Returns:
- a new
RowRanges.Builderfor constructing aRowRangesfrom a sequence of selected row indices.
-