-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[WIP] Fix for issue #333 #386
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,9 +200,11 @@ private boolean writeUpdateRecord(HoodieRecord<T> hoodieRecord, | |
*/ | ||
public void write(GenericRecord oldRecord) { | ||
String key = oldRecord.get(HoodieRecord.RECORD_KEY_METADATA_FIELD).toString(); | ||
HoodieRecord<T> hoodieRecord = keyToNewRecords.get(key); | ||
boolean copyOldRecord = true; | ||
if (keyToNewRecords.containsKey(key)) { | ||
// If we have duplicate records that we are updating, then the hoodie record will be deflated after | ||
// writing the first record. So make a copy of the record to be merged | ||
HoodieRecord<T> hoodieRecord = new HoodieRecord<>(keyToNewRecords.get(key)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test did not catch this, as HoodieMergeHandle uses SpillableMap and the get here uses the DiskBasedMap and hence returns a new HoodieRecord everytime. If the get, gets the value from InMemoryMap, then there will be an issue when there are duplicate records. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This piece of code is very specific to this use-case and will make re-factoring of the code tricky, also again what is the garbage collection implication of this ? |
||
try { | ||
Optional<IndexedRecord> combinedAvroRecord = hoodieRecord.getData() | ||
.combineAndGetUpdateValue(oldRecord, schema); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking if the currentLocation is set, I think creating the record every time is cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the implication of doing this ? Will this trigger a huge number of objects being created ?