Class 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:
    ColumnIndexFilter.calculateRowRanges(Filter, ColumnIndexStore, Set, long)
    • Field Detail

    • Method Detail

      • 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
      • create

        public static RowRanges create​(long rowCount,
                                       PrimitiveIterator.OfInt pageIndexes,
                                       OffsetIndex offsetIndex)
        Creates a mutable RowRanges object with the following ranges:
         [firstRowIndex[0], lastRowIndex[0]],
         [firstRowIndex[1], lastRowIndex[1]],
         ...,
         [firstRowIndex[n], lastRowIndex[n]]
         
        (See OffsetIndex.getFirstRowIndex and OffsetIndex.getLastRowIndex for details.) The union of the ranges are calculated so the result ranges always contain the disjunct ranges. See union for details.
        Parameters:
        rowCount - row count
        pageIndexes - pageIndexes
        offsetIndex - offsetIndex
        Returns:
        a mutable 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