@Internal public final class SqlTimestampComparator extends BasicTypeComparator<Date>
ascendingComparison
Constructor and Description |
---|
SqlTimestampComparator(boolean ascending) |
Modifier and Type | Method and Description |
---|---|
int |
compareSerialized(DataInputView firstSource,
DataInputView secondSource)
Compares two records in serialized form.
|
SqlTimestampComparator |
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(Date record,
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<Date>
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<Date>
public int getNormalizeKeyLen()
TypeComparator
Integer
.MAX_VALUE is interpreted as infinite.getNormalizeKeyLen
in class TypeComparator<Date>
public boolean isNormalizedKeyPrefixOnly(int keyBytes)
TypeComparator
isNormalizedKeyPrefixOnly
in class TypeComparator<Date>
public void putNormalizedKey(Date record, 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<Date>
record
- 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 SqlTimestampComparator duplicate()
TypeComparator
duplicate
in class TypeComparator<Date>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.