Class ObjectColumnBinarySearchKernel

java.lang.Object
io.deephaven.engine.table.impl.sources.regioned.kernel.ObjectColumnBinarySearchKernel

public class ObjectColumnBinarySearchKernel extends Object
  • Constructor Details

    • ObjectColumnBinarySearchKernel

      public ObjectColumnBinarySearchKernel()
  • Method Details

    • binsearchRangeFilter

      public static RowSet binsearchRangeFilter(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull AbstractRangeFilter filter, boolean usePrev)
      Performs a binary search on a sorted ElementSource using bounds from an AbstractRangeFilter (either SingleSidedComparableRangeFilter or ComparableRangeFilter), returning the row keys that satisfy the filter.
      Parameters:
      source - The element source to search.
      selection - The RowSet defining which rows are populated and the order in which they are searched.
      sortColumn - A SortColumn representing the sorting order.
      filter - The range filter supplying bounds and their inclusive flags.
      usePrev - If true, uses previous values instead of current values.
      Returns:
      A RowSet containing the row keys satisfying the filter.
    • binarySearchMatchWithConsistentEquality

      public static RowSet binarySearchMatchWithConsistentEquality(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull Object[] searchValues, boolean usePrev)
      Performs a binary search on a given sorted ElementSource to find the row keys from a provided RowSet that pass a range or match filter. The method returns the RowSet containing the matched row keys.

      Ordering alone decides a match: every row that compares equal to a search value is returned. This is valid for types whose values compare equal exactly when they are equal, as BinarySearchKernelHelper.compareConsistentWithEquality(Class) describes, and for BigDecimal, whose match filter matches by compareTo; for any other type, binarySearchMatchWithGeneralEquality(io.deephaven.engine.table.ColumnSource<?>, io.deephaven.engine.rowset.RowSet, io.deephaven.api.SortColumn, java.lang.Object[], boolean) applies.

      The binary search is performed over the positions defined by selection. RowSet.get(long) is used to map positions to row keys, ensuring O(log n) performance even when the row key space is sparse.

      Parameters:
      source - The element source in which the search will be performed.
      selection - The RowSet defining which rows are populated and the order in which they are searched.
      sortColumn - A SortColumn object representing the sorting order of the column.
      searchValues - An array of keys to find within the source.
      usePrev - If true, the search will use the previous values (getPrevObject) instead of current values (getObject).
      Returns:
      A RowSet containing the row keys where the sorted keys were found.
    • binarySearchMatchWithGeneralEquality

      public static RowSet binarySearchMatchWithGeneralEquality(@NotNull @NotNull ColumnSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull Object[] searchValues, boolean usePrev)
      Performs a binary search on a given sorted ColumnSource to find the row keys from a provided RowSet that hold a value equal to one of searchValues. The method returns the RowSet containing the matched row keys.

      Correct for any Comparable type: ordering locates the run of rows that compare equal to a search value, and ObjectComparisons.eq(Object, Object) selects the rows of that run that match.

      Parameters:
      source - The column source in which the search will be performed.
      selection - The RowSet defining which rows are populated and the order in which they are searched.
      sortColumn - A SortColumn object representing the sorting order of the column.
      searchValues - An array of keys to find within the source.
      usePrev - If true, the search will use the previous values instead of current values.
      Returns:
      A RowSet containing the row keys that are equal to one of the search values.
    • binarySearchMinMax

      public static RowSet binarySearchMinMax(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, Object min, Object max, boolean minInc, boolean maxInc, boolean usePrev)
      Performs a binary search on a given sorted ElementSource to find the positions (row keys) of values within a specified range.

      The binary search is performed over the positions defined by selection. RowSet.get(long) is used to map positions to row keys, ensuring O(log n) performance even when the row key space is sparse.

      Parameters:
      source - The element source in which the search will be performed.
      selection - The RowSet defining which rows are populated and the order in which they are searched.
      sortColumn - A SortColumn object representing the sorting order of the column.
      min - The minimum value of the range.
      max - The maximum value of the range.
      minInc - true if the minimum value is inclusive, false otherwise.
      maxInc - true if the maximum value is inclusive, false otherwise.
      usePrev - If true, the search will use the previous values (getPrevObject) instead of current values (getObject).
      Returns:
      A RowSet containing the row keys where the values were found.
    • binarySearchMin

      public static RowSet binarySearchMin(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, Object min, boolean minInc, boolean usePrev)
      Performs a binary search on a given sorted ElementSource to find the positions (row keys) of values greater than a specified minimum.

      The binary search is performed over the positions defined by selection. RowSet.get(long) is used to map positions to row keys, ensuring O(log n) performance even when the row key space is sparse.

      Parameters:
      source - The element source in which the search will be performed.
      selection - The RowSet defining which rows are populated and the order in which they are searched.
      sortColumn - A SortColumn object representing the sorting order of the column.
      min - The minimum value of the range.
      minInc - true if the minimum value is inclusive, false otherwise.
      usePrev - If true, the search will use the previous values (getPrevObject) instead of current values (getObject).
      Returns:
      A RowSet containing the row keys where the values were found.
    • binarySearchMax

      public static RowSet binarySearchMax(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, Object max, boolean maxInc, boolean usePrev)
      Performs a binary search on a given sorted ElementSource to find the positions (row keys) of values less than a specified maximum.

      The binary search is performed over the positions defined by selection. RowSet.get(long) is used to map positions to row keys, ensuring O(log n) performance even when the row key space is sparse.

      Parameters:
      source - The element source in which the search will be performed.
      selection - The RowSet defining which rows are populated and the order in which they are searched.
      sortColumn - A SortColumn object representing the sorting order of the column.
      max - The maximum value of the range.
      maxInc - true if the maximum value is inclusive, false otherwise.
      usePrev - If true, the search will use the previous values (getPrevObject) instead of current values (getObject).
      Returns:
      A RowSet containing the row keys where the values were found.