public final class RecordComparator extends TypeComparator<Record>
TypeComparator interface for the pact record. Instances of this class
are parameterized with which fields are relevant to the comparison.| Constructor and Description |
|---|
RecordComparator(int[] keyFields,
Class<? extends Key<?>>[] keyTypes)
Creates a new comparator that compares Pact Records by the subset of fields as described
by the given key positions and types.
|
RecordComparator(int[] keyFields,
Class<? extends Key<?>>[] keyTypes,
boolean[] sortDirection)
Creates a new comparator that compares Pact Records by the subset of fields as described
by the given key positions and types.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(DataInputView source1,
DataInputView source2) |
int |
compare(Record first,
Record second) |
int |
compareAgainstReference(Comparable[] keys) |
int |
compareToReference(TypeComparator<Record> referencedAccessors) |
RecordComparator |
duplicate() |
boolean |
equalToReference(Record candidate) |
int[] |
getKeyPositions() |
Key<?>[] |
getKeysAsCopy(Record record) |
Class<? extends Key<?>>[] |
getKeyTypes() |
int |
getNormalizeKeyLen() |
int |
hash(Record object) |
boolean |
invertNormalizedKey() |
boolean |
isNormalizedKeyPrefixOnly(int keyBytes) |
void |
putNormalizedKey(Record record,
MemorySegment target,
int offset,
int numBytes) |
Record |
readWithKeyDenormalization(Record reuse,
DataInputView source) |
void |
setReference(Record toCompare) |
boolean |
supportsCompareAgainstReference() |
boolean |
supportsNormalizedKey() |
boolean |
supportsSerializationWithKeyNormalization() |
void |
writeWithKeyNormalization(Record record,
DataOutputView target) |
public RecordComparator(int[] keyFields,
Class<? extends Key<?>>[] keyTypes)
keyFields - The positions of the key fields.keyTypes - The types (classes) of the key fields.public RecordComparator(int[] keyFields,
Class<? extends Key<?>>[] keyTypes,
boolean[] sortDirection)
keyFields - The positions of the key fields.keyTypes - The types (classes) of the key fields.sortDirection - The direction for sorting. A value of true indicates ascending for an attribute,
a value of false indicated descending. If the parameter is null, then
all order comparisons will assume ascending order on all fields.public int hash(Record object)
hash in class TypeComparator<Record>public void setReference(Record toCompare)
setReference in class TypeComparator<Record>public boolean equalToReference(Record candidate)
equalToReference in class TypeComparator<Record>public int compareToReference(TypeComparator<Record> referencedAccessors)
compareToReference in class TypeComparator<Record>public int compare(Record first, Record second)
compare in class TypeComparator<Record>public int compare(DataInputView source1, DataInputView source2) throws IOException
compare in class TypeComparator<Record>IOExceptionpublic boolean supportsNormalizedKey()
supportsNormalizedKey in class TypeComparator<Record>public int getNormalizeKeyLen()
getNormalizeKeyLen in class TypeComparator<Record>public boolean isNormalizedKeyPrefixOnly(int keyBytes)
isNormalizedKeyPrefixOnly in class TypeComparator<Record>public void putNormalizedKey(Record record, MemorySegment target, int offset, int numBytes)
putNormalizedKey in class TypeComparator<Record>public boolean invertNormalizedKey()
invertNormalizedKey in class TypeComparator<Record>public boolean supportsSerializationWithKeyNormalization()
supportsSerializationWithKeyNormalization in class TypeComparator<Record>public void writeWithKeyNormalization(Record record, DataOutputView target)
writeWithKeyNormalization in class TypeComparator<Record>public Record readWithKeyDenormalization(Record reuse, DataInputView source)
readWithKeyDenormalization in class TypeComparator<Record>public RecordComparator duplicate()
duplicate in class TypeComparator<Record>public final int[] getKeyPositions()
public boolean supportsCompareAgainstReference()
supportsCompareAgainstReference in class TypeComparator<Record>public final int compareAgainstReference(Comparable[] keys)
compareAgainstReference in class TypeComparator<Record>Copyright © 2014 The Apache Software Foundation. All rights reserved.