ad1happy2go opened a new issue, #20599:
URL: https://github.com/apache/hudi/issues/20599

   With 
`hoodie.datasource.write.keygenerator.consistent.logical.timestamp.enabled=true`
 and a `timestamp-millis` / `timestamp-micros` ordering field, an upsert that 
updates existing keys fails on 1.x. The flag is meant for record keys and 
partition paths, but it also turns the incoming ordering value into a 
`java.sql.Timestamp`, while the value read back from the base file stays a 
`Long`.
   
   - COW: `ClassCastException: java.lang.Long cannot be cast to java.util.Date` 
in `Timestamp.compareTo`, from 
`BufferedRecordMergerFactory.shouldKeepNewerRecord` via 
`EventTimeRecordMerger.finalMerge`.
   - MOR: writing a delete fails with `Timestamp cannot be cast to Number` in 
`HoodieAppendHandle`.
   - The payload comparisons (`DefaultHoodieRecordPayload`, 
`PartialUpdateAvroPayload`) truncate micros to millis, so two records less than 
a millisecond apart tie and the older one can win.
   
   This blocks upgrading tables written by 0.x with this flag on, and a table 
with a timestamp record key or partition path can't simply turn the flag off. 
Setting 
`hoodie.write.merge.handle.class=org.apache.hudi.io.HoodieWriteMergeHandle` 
works around the COW failure.
   
   Proposal: ordering values should not take the key-generator conversion and 
should always stay in their stored form, as the Spark record path already does.
   


-- 
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]

Reply via email to