@Internal public final class BooleanComparator extends BasicTypeComparator<Boolean>
ascendingComparison
Constructor and Description |
---|
BooleanComparator(boolean ascending) |
Modifier and Type | Method and Description |
---|---|
int |
compareSerialized(DataInputView firstSource,
DataInputView secondSource)
Compares two records in serialized form.
|
BooleanComparator |
duplicate()
Creates a copy of this class.
|
int |
getNormalizeKeyLen()
Gets the number of bytes that the normalized key would maximally take.
|
boolean |
isNormalizedKeyPrefixOnly(int keyBytes)
Checks, whether the given number of bytes for a normalized is only a prefix to determine the
order of elements of the data type for which this comparator provides the comparison methods.
|
void |
putNormalizedKey(Boolean value,
MemorySegment target,
int offset,
int numBytes)
Writes a normalized key for the given record into the target byte array, starting at the
specified position and writing exactly the given number of bytes.
|
boolean |
supportsNormalizedKey()
Checks whether the data type supports the creation of a normalized key for comparison.
|
compare, compareToReference, equalToReference, extractKeys, getFlatComparators, hash, invertNormalizedKey, readWithKeyDenormalization, setReference, supportsSerializationWithKeyNormalization, writeWithKeyNormalization
compareAgainstReference, supportsCompareAgainstReference
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException
TypeComparator
Comparator.compare(Object, Object)
.
This method may de-serialize the records or compare them directly based on their binary representation.
compareSerialized
in class TypeComparator<Boolean>
firstSource
- The input view containing the first record.secondSource
- The input view containing the second record.Comparator.compare(Object, Object)
.IOException
- Thrown, if any of the input views raised an exception when reading the
records.Comparator.compare(Object, Object)
public boolean supportsNormalizedKey()
TypeComparator
supportsNormalizedKey
in class TypeComparator<Boolean>
public int getNormalizeKeyLen()
TypeComparator
Integer
.MAX_VALUE is interpreted as infinite.getNormalizeKeyLen
in class TypeComparator<Boolean>
public boolean isNormalizedKeyPrefixOnly(int keyBytes)
TypeComparator
isNormalizedKeyPrefixOnly
in class TypeComparator<Boolean>
public void putNormalizedKey(Boolean value, MemorySegment target, int offset, int numBytes)
TypeComparator
int byteI = bytes[i] & 0xFF;
If the meaningful part of the normalized key takes less than the given number of bytes,
then it must be padded. Padding is typically required for variable length data types, such as
strings. The padding uses a special character, either 0
or 0xff
, depending on
whether shorter values are sorted to the beginning or the end.
This method is similar to NormalizableKey.copyNormalizedKey(MemorySegment, int, int)
. In the
case that multiple fields of a record contribute to the normalized key, it is crucial that
the fields align on the byte field, i.e. that every field always takes up the exact same
number of bytes.
putNormalizedKey
in class TypeComparator<Boolean>
value
- The record for which to create the normalized key.target
- The byte array into which to write the normalized key bytes.offset
- The offset in the byte array, where to start writing the normalized key bytes.numBytes
- The number of bytes to be written exactly.NormalizableKey.copyNormalizedKey(MemorySegment, int, int)
public BooleanComparator duplicate()
TypeComparator
duplicate
in class TypeComparator<Boolean>
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.