Class VectorRangeSearcher

java.lang.Object
org.apache.arrow.algorithm.search.VectorRangeSearcher

public class VectorRangeSearcher extends Object
Search for the range of a particular element in the target vector.
  • Field Details

    • SEARCH_FAIL_RESULT

      public static final int SEARCH_FAIL_RESULT
      Result returned when a search fails.
      See Also:
  • Constructor Details

    • VectorRangeSearcher

      public VectorRangeSearcher()
  • Method Details

    • getFirstMatch

      public static <V extends ValueVector> int getFirstMatch(V targetVector, VectorValueComparator<V> comparator, V keyVector, int keyIndex)
      Search for the first occurrence of an element. The search is based on the binary search algorithm. So the target vector must be sorted.
      Type Parameters:
      V - the vector type.
      Parameters:
      targetVector - the vector from which to perform the search.
      comparator - the criterion for the comparison.
      keyVector - the vector containing the element to search.
      keyIndex - the index of the search key in the key vector.
      Returns:
      the index of the first matched element if any, and -1 otherwise.
    • getLastMatch

      public static <V extends ValueVector> int getLastMatch(V targetVector, VectorValueComparator<V> comparator, V keyVector, int keyIndex)
      Search for the last occurrence of an element. The search is based on the binary search algorithm. So the target vector must be sorted.
      Type Parameters:
      V - the vector type.
      Parameters:
      targetVector - the vector from which to perform the search.
      comparator - the criterion for the comparison.
      keyVector - the vector containing the element to search.
      keyIndex - the index of the search key in the key vector.
      Returns:
      the index of the last matched element if any, and -1 otherwise.