danny0405 commented on code in PR #20544:
URL: https://github.com/apache/hudi/pull/20544#discussion_r4537635657
##########
hudi-common/src/main/java/org/apache/hudi/common/avro/AvroOrderingValueConverter.java:
##########
@@ -72,11 +77,28 @@ public Comparable convert(Comparable value) {
}
private Comparable convertFieldValue(Comparable value, HoodieSchema
fieldSchema) {
- if (value == null) {
- return null;
+ // Decoded decimals already use the representation needed for comparison.
+ if (value == null || value instanceof BigDecimal) {
+ return value;
+ }
+ Schema avroSchema = fieldSchema.toAvroSchema();
+ LogicalType logicalType = avroSchema.getLogicalType();
+ // Normalize decoded delete values here. Timestamp precision and
configuration
+ // handling remain shared with data records.
+ if (value instanceof String) {
+ return new Utf8((String) value);
+ }
+ if (value instanceof Date) {
+ return ((Date) value).toLocalDate();
+ }
+ if (value instanceof Timestamp) {
+ if (logicalType == LogicalTypes.localTimestampMillis() || logicalType ==
LogicalTypes.localTimestampMicros()) {
+ value = ((Timestamp) value).toLocalDateTime();
Review Comment:
can you inline the logic and return early instead of splitting the logic in
multiple places?
--
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]