Class ObjectRegionBinarySearchKernel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RowSetbinarySearchMatchWithConsistentEquality(ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull SortColumn sortColumn, @NotNull Object[] searchValues) Performs a binary search on a given column region to find the positions (row keys) of specified keys.static RowSetbinarySearchMatchWithGeneralEquality(@NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull SortColumn sortColumn, @NotNull Object[] searchValues) Performs a binary search on a given column region to find the row keys holding a value equal to one ofsearchValues.static RowSetbinarySearchMax(@NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull SortColumn sortColumn, Object max, boolean maxInc) Performs a binary search on a given column region to find the positions (row keys) of values less than a specified maximum.static RowSetbinarySearchMin(@NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull SortColumn sortColumn, Object min, boolean minInc) Performs a binary search on a given column region to find the positions (row keys) of values greater than a specified minimum.static RowSetbinarySearchMinMax(@NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull SortColumn sortColumn, Object min, Object max, boolean minInc, boolean maxInc) Performs a binary search on a given column region to find the positions (row keys) of values within a specified range.static RowSetbinsearchMatchFilter(@NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull SortColumn sortColumn, @NotNull MatchFilter filter) Performs a binary search on a sorted column region for the values of aMatchFilter, returning the row keys that hold one of them.static RowSetbinsearchRangeFilter(@NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull SortColumn sortColumn, @NotNull AbstractRangeFilter filter) Performs a binary search on a sorted column region using bounds from anAbstractRangeFilter(eitherSingleSidedComparableRangeFilterorComparableRangeFilter), returning the row keys that satisfy the filter.
-
Constructor Details
-
ObjectRegionBinarySearchKernel
public ObjectRegionBinarySearchKernel()
-
-
Method Details
-
binsearchRangeFilter
public static RowSet binsearchRangeFilter(@NotNull @NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull AbstractRangeFilter filter) Performs a binary search on a sorted column region using bounds from anAbstractRangeFilter(eitherSingleSidedComparableRangeFilterorComparableRangeFilter), returning the row keys that satisfy the filter.- Parameters:
region- The column region to search.firstKey- The first key in the column region to consider for the search.lastKey- The last key in the column region to consider for the search.sortColumn- ASortColumnrepresenting the sorting order.filter- The range filter supplying bounds and their inclusive flags.- Returns:
- A
RowSetcontaining the row keys satisfying the filter.
-
binsearchMatchFilter
public static RowSet binsearchMatchFilter(@NotNull @NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull MatchFilter filter) Performs a binary search on a sorted column region for the values of aMatchFilter, returning the row keys that hold one of them. The filter'sinvertedflag is not applied here; the caller must invert the result itself.The filter's column type chooses the search:
binarySearchMatchWithConsistentEquality(io.deephaven.engine.table.impl.sources.regioned.ColumnRegionObject<?, ?>, long, long, io.deephaven.api.SortColumn, java.lang.Object[]), which lets ordering alone decide a match, forBigDecimal, whose match filter matches by compareTo, and for a type for whichBinarySearchKernelHelper.compareConsistentWithEquality(Class)holds; andbinarySearchMatchWithGeneralEquality(io.deephaven.engine.table.impl.sources.regioned.ColumnRegionObject<?, ?>, long, long, io.deephaven.api.SortColumn, java.lang.Object[]), which picks the matches out of each ordering-equal run by equality, for any other type.- Parameters:
region- The column region to search.firstKey- The first key in the column region to consider for the search.lastKey- The last key in the column region to consider for the search.sortColumn- ASortColumnrepresenting the sorting order.filter- The match filter supplying the values to find.- Returns:
- A
RowSetcontaining the row keys holding one of the filter's values.
-
binarySearchMatchWithConsistentEquality
public static RowSet binarySearchMatchWithConsistentEquality(ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull Object[] searchValues) Performs a binary search on a given column region to find the positions (row keys) of specified keys. 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 forBigDecimal, whose match filter matches by compareTo; for any other type,binarySearchMatchWithGeneralEquality(io.deephaven.engine.table.impl.sources.regioned.ColumnRegionObject<?, ?>, long, long, io.deephaven.api.SortColumn, java.lang.Object[])applies.- Parameters:
region- The column region in which the search will be performed.firstKey- The first key in the column region to consider for the search.lastKey- The last key in the column region to consider for the search.sortColumn- ASortColumnobject representing the sorting order of the column.searchValues- An array of keys to find within the column region.- Returns:
- A
RowSetcontaining the row keys where the sorted keys were found.
-
binarySearchMatchWithGeneralEquality
public static RowSet binarySearchMatchWithGeneralEquality(@NotNull @NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull Object[] searchValues) Performs a binary search on a given column region to find the row keys holding a value equal to one ofsearchValues. The method returns theRowSetcontaining the matched row keys.Correct for any
Comparabletype: ordering locates the run of rows that compare equal to a search value, andObjectComparisons.eq(Object, Object)selects the rows of that run that match.- Parameters:
region- The column region in which the search will be performed.firstKey- The first key in the column region to consider for the search.lastKey- The last key in the column region to consider for the search.sortColumn- ASortColumnobject representing the sorting order of the column.searchValues- An array of keys to find within the column region.- Returns:
- A
RowSetcontaining the row keys that are equal to one of the search values.
-
binarySearchMinMax
public static RowSet binarySearchMinMax(@NotNull @NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull @NotNull SortColumn sortColumn, Object min, Object max, boolean minInc, boolean maxInc) Performs a binary search on a given column region to find the positions (row keys) of values within a specified range.- Parameters:
region- The column region in which the search will be performed.firstKey- The first key in the column region to consider for the search.lastKey- The last key in the column region to consider for the search.sortColumn- ASortColumnobject representing the sorting order of the column.min- The minimum value of the range.max- The maximum value of the range.minInc-trueif the minimum value is inclusive,falseotherwise.maxInc-trueif the maximum value is inclusive,falseotherwise.- Returns:
- A
RowSetcontaining the row keys where the values were found.
-
binarySearchMin
public static RowSet binarySearchMin(@NotNull @NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull @NotNull SortColumn sortColumn, Object min, boolean minInc) Performs a binary search on a given column region to find the positions (row keys) of values greater than a specified minimum.- Parameters:
region- The column region in which the search will be performed.firstKey- The first key in the column region to consider for the search.lastKey- The last key in the column region to consider for the search.sortColumn- ASortColumnobject representing the sorting order of the column.min- The minimum value of the range.minInc-trueif the minimum value is inclusive,falseotherwise.- Returns:
- A
RowSetcontaining the row keys where the values were found.
-
binarySearchMax
public static RowSet binarySearchMax(@NotNull @NotNull ColumnRegionObject<?, ?> region, long firstKey, long lastKey, @NotNull @NotNull SortColumn sortColumn, Object max, boolean maxInc) Performs a binary search on a given column region to find the positions (row keys) of values less than a specified maximum.- Parameters:
region- The column region in which the search will be performed.firstKey- The first key in the column region to consider for the search.lastKey- The last key in the column region to consider for the search.sortColumn- ASortColumnobject representing the sorting order of the column.max- The maximum value of the range.maxInc-trueif the maximum value is inclusive,falseotherwise.- Returns:
- A
RowSetcontaining the row keys where the values were found.
-