Class RowRanges

java.lang.Object
org.apache.parquet.filter2.columnindex.RowRanges
Direct Known Subclasses:
RowRanges

public class RowRanges extends Object
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.
See Also:
  • Field Details

    • EMPTY

      public static final RowRanges EMPTY
  • Constructor Details

    • RowRanges

      protected RowRanges()
  • Method Details

    • createSingle

      public static RowRanges createSingle(long rowCount)
      Creates an immutable RowRanges object with the single range [0, rowCount - 1].
      Parameters:
      rowCount - a single row count
      Returns:
      an immutable RowRanges
    • union

      public static RowRanges union(RowRanges left, RowRanges right)
      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 RowRanges
      right - right RowRanges
      Returns:
      a mutable RowRanges contains all the row indexes that were contained in one of the specified objects
    • intersection

      public static RowRanges intersection(RowRanges left, RowRanges right)
      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 RowRanges
      right - 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

      public PrimitiveIterator.OfLong 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 connection
      to - the last row of the range to be checked for connection
      Returns:
      true if the specified range is overlapping (have common elements) with one of the ranges
    • getRanges

      public List<RowRanges.Range> getRanges()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static RowRanges.Builder builder()
      Returns:
      a new RowRanges.Builder for constructing a RowRanges from a sequence of selected row indices.