Class ComparableRecordComparator
java.lang.Object
org.apache.flink.table.runtime.operators.rank.ComparableRecordComparator
- All Implemented Interfaces:
Serializable,Comparator<org.apache.flink.table.data.RowData>,RecordComparator
Because it's impossible to restore a
RecordComparator instance generated by GeneratedRecordComparator from checkpoint snapshot. Hence, we introduce ComparableRecordComparator class to wrap the GeneratedRecordComparator. A ComparableRecordComparator instance is serializable and can restore the RecordComparator
from the serialized ComparableRecordComparator. Besides, the equals(Object) doesn't take GeneratedRecordComparator into
account, because the code is not deterministic across different client. Therefore, equals(Object) only compares the meta information used for generating
code of RecordComparator.
Note: currently, this class is only used for RetractableTopNFunction.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionComparableRecordComparator(GeneratedRecordComparator generatedRecordComparator, int[] compareKeyPositions, org.apache.flink.table.types.logical.LogicalType[] compareKeyTypes, boolean[] compareOrders, boolean[] nullsIsLast) -
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
ComparableRecordComparator
public ComparableRecordComparator(GeneratedRecordComparator generatedRecordComparator, int[] compareKeyPositions, org.apache.flink.table.types.logical.LogicalType[] compareKeyTypes, boolean[] compareOrders, boolean[] nullsIsLast)
-
-
Method Details
-
getGeneratedRecordComparator
-
compare
public int compare(org.apache.flink.table.data.RowData o1, org.apache.flink.table.data.RowData o2) - Specified by:
comparein interfaceComparator<org.apache.flink.table.data.RowData>- Specified by:
comparein interfaceRecordComparator
-
hashCode
public int hashCode() -
equals
- Specified by:
equalsin interfaceComparator<org.apache.flink.table.data.RowData>- Overrides:
equalsin classObject
-