Class IntPrimitiveArrayComparator
- java.lang.Object
-
- org.apache.flink.api.common.typeutils.TypeComparator<T>
-
- org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator<int[],IntComparator>
-
- org.apache.flink.api.common.typeutils.base.array.IntPrimitiveArrayComparator
-
- All Implemented Interfaces:
Serializable
@Internal public class IntPrimitiveArrayComparator extends PrimitiveArrayComparator<int[],IntComparator>
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator
ascending, comparator, reference
-
-
Constructor Summary
Constructors Constructor Description IntPrimitiveArrayComparator(boolean ascending)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(int[] first, int[] second)
Compares two records in object form.TypeComparator<int[]>
duplicate()
Creates a copy of this class.int
hash(int[] record)
Computes a hash value for the given record.-
Methods inherited from class org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator
compareSerialized, compareToReference, equalToReference, extractKeys, getFlatComparators, getNormalizeKeyLen, invertNormalizedKey, isNormalizedKeyPrefixOnly, putNormalizedKey, readWithKeyDenormalization, setReference, supportsNormalizedKey, supportsSerializationWithKeyNormalization, writeWithKeyNormalization
-
Methods inherited from class org.apache.flink.api.common.typeutils.TypeComparator
compareAgainstReference, supportsCompareAgainstReference
-
-
-
-
Method Detail
-
hash
public int hash(int[] record)
Description copied from class:TypeComparator
Computes a hash value for the given record. The hash value should include all fields in the record relevant to the comparison.The hash code is typically not used as it is in hash tables and for partitioning, but it is further scrambled to make sure that a projection of the hash values to a lower cardinality space is as results in a rather uniform value distribution. However, any collisions produced by this method cannot be undone. While it is NOT important to create hash codes that cover the full spectrum of bits in the integer, it IS important to avoid collisions when combining two value as much as possible.
- Specified by:
hash
in classTypeComparator<int[]>
- Parameters:
record
- The record to be hashed.- Returns:
- A hash value for the record.
- See Also:
Object.hashCode()
-
compare
public int compare(int[] first, int[] second)
Description copied from class:TypeComparator
Compares two records in object form. The return value indicates the order of the two in the same way as defined byComparator.compare(Object, Object)
.- Specified by:
compare
in classTypeComparator<int[]>
- Parameters:
first
- The first record.second
- The second record.- Returns:
- An integer defining the oder among the objects in the same way as
Comparator.compare(Object, Object)
. - See Also:
Comparator.compare(Object, Object)
-
duplicate
public TypeComparator<int[]> duplicate()
Description copied from class:TypeComparator
Creates a copy of this class. The copy must be deep such that no state set in the copy affects this instance of the comparator class.- Specified by:
duplicate
in classTypeComparator<int[]>
- Returns:
- A deep copy of this comparator instance.
-
-