cshuo commented on code in PR #19307:
URL: https://github.com/apache/hudi/pull/19307#discussion_r3635024015
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/bulk/RowDataKeyGen.java:
##########
@@ -170,6 +170,26 @@ public String getRecordKey(RowData rowData) {
}
}
+ /**
+ * Returns a compact key that preserves the ordering of the encoded Hudi
record key.
+ *
+ * <p>The first {@code <field>:} prefix used by complex keys and the legacy
simple-key encoding
+ * is identical for all records and is omitted. Subsequent {@code ,<field>:}
separators in a
+ * complex key are retained because field values may contain the same
delimiter characters;
+ * removing them could make distinct record keys compare equal.
+ */
+ public String getRecordKeyForComparison(RowData rowData) {
+ if (this.simpleRecordKeyFunc != null) {
+ return getRecordKey(recordKeyFieldGetter.getFieldOrNull(rowData),
+ this.recordKeyFields[0], consistentLogicalTimestampEnabled);
+ } else {
+ Object[] keyValues = this.recordKeyProjection.projectAsValues(rowData);
+ String recordKey = getRecordKey(keyValues, this.recordKeyFields,
consistentLogicalTimestampEnabled);
+ return recordKey.substring(
Review Comment:
fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]