Module org.apache.arrow.algorithm
Package org.apache.arrow.algorithm.sort
Class IndexSorter<V extends ValueVector>
java.lang.Object
org.apache.arrow.algorithm.sort.IndexSorter<V>
- Type Parameters:
V
- vector type.
Sorter for the indices of a vector.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
If the number of items is smaller than this threshold, we will use another algorithm to sort the data. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ValueVector>
intpartition
(int low, int high, IntVector indices, VectorValueComparator<T> comparator) Partition a range of values in a vector into two parts, with elements in one part smaller than elements from the other part.void
sort
(V vector, IntVector indices, VectorValueComparator<V> comparator) Sorts indices, by quick-sort.
-
Field Details
-
CHANGE_ALGORITHM_THRESHOLD
public static final int CHANGE_ALGORITHM_THRESHOLDIf the number of items is smaller than this threshold, we will use another algorithm to sort the data.- See Also:
-
-
Constructor Details
-
IndexSorter
public IndexSorter()
-
-
Method Details
-
sort
Sorts indices, by quick-sort. Suppose the vector is denoted by v. After calling this method, the following relations hold: v(indices[0]) <= v(indices[1]) <= ...- Parameters:
vector
- the vector whose indices need to be sorted.indices
- the vector for storing the sorted indices.comparator
- the comparator to sort indices.
-
partition
public static <T extends ValueVector> int partition(int low, int high, IntVector indices, VectorValueComparator<T> comparator) Partition a range of values in a vector into two parts, with elements in one part smaller than elements from the other part. The partition is based on the element indices, so it does not modify the underlying vector.- Type Parameters:
T
- the vector type.- Parameters:
low
- the lower bound of the range.high
- the upper bound of the range.indices
- vector element indices.comparator
- criteria for comparison.- Returns:
- the index of the split point.
-