Class CompositeVectorComparator

java.lang.Object
org.apache.arrow.algorithm.sort.VectorValueComparator<ValueVector>
org.apache.arrow.algorithm.sort.CompositeVectorComparator

public class CompositeVectorComparator extends VectorValueComparator<ValueVector>
A composite vector comparator compares a number of vectors by a number of inner comparators.

It works by first using the first comparator, if a non-zero value is returned, it simply returns it. Otherwise, it uses the second comparator, and so on, until a non-zero value is produced, or all inner comparators have been used.

  • Constructor Details

  • Method Details

    • compareNotNull

      public int compareNotNull(int index1, int index2)
      Description copied from class: VectorValueComparator
      Compare two values, given their indices. This is a fast path for comparing non-null values, so the caller must make sure that values at both indices are not null.
      Specified by:
      compareNotNull in class VectorValueComparator<ValueVector>
      Parameters:
      index1 - index of the first value to compare.
      index2 - index of the second value to compare.
      Returns:
      an integer greater than 0, if the first value is greater; an integer smaller than 0, if the first value is smaller; or 0, if both values are equal.
    • compare

      public int compare(int index1, int index2)
      Description copied from class: VectorValueComparator
      Compare two values, given their indices.
      Overrides:
      compare in class VectorValueComparator<ValueVector>
      Parameters:
      index1 - index of the first value to compare.
      index2 - index of the second value to compare.
      Returns:
      an integer greater than 0, if the first value is greater; an integer smaller than 0, if the first value is smaller; or 0, if both values are equal.
    • createNew

      public VectorValueComparator<ValueVector> createNew()
      Description copied from class: VectorValueComparator
      Creates a comparator of the same type.
      Specified by:
      createNew in class VectorValueComparator<ValueVector>
      Returns:
      the newly created comparator.