linliu-code commented on code in PR #17601:
URL: https://github.com/apache/hudi/pull/17601#discussion_r2738916420
##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -1040,12 +1051,35 @@ private static Object rewritePrimaryType(Object
oldValue, Schema oldSchema, Sche
case NULL:
case BOOLEAN:
case INT:
- case LONG:
case FLOAT:
case DOUBLE:
case BYTES:
case STRING:
return oldValue;
+ case LONG:
+ if (oldSchema.getLogicalType() != newSchema.getLogicalType()) {
+ if (oldSchema.getLogicalType() == null ||
newSchema.getLogicalType() == null) {
+ return oldValue;
+ } else if (oldSchema.getLogicalType() instanceof
LogicalTypes.TimestampMillis) {
+ if (newSchema.getLogicalType() instanceof
LogicalTypes.TimestampMicros) {
+ return DateTimeUtils.millisToMicros((Long) oldValue);
+ }
+ } else if (oldSchema.getLogicalType() instanceof
LogicalTypes.TimestampMicros) {
+ if (newSchema.getLogicalType() instanceof
LogicalTypes.TimestampMillis) {
+ return DateTimeUtils.microsToMillis((Long) oldValue);
+ }
+ } else if (isLocalTimestampMillis(oldSchema.getLogicalType())) {
+ if (isLocalTimestampMicros(newSchema.getLogicalType())) {
+ return DateTimeUtils.millisToMicros((Long) oldValue);
Review Comment:
yes, from Jon's PR.
--
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]