-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HUDI-6909] Use isDelete instead of isDeleted function for Spark merger #12007
[HUDI-6909] Use isDelete instead of isDeleted function for Spark merger #12007
Conversation
b416e96
to
c08c321
Compare
@@ -50,7 +50,7 @@ public Option<Pair<HoodieRecord, Schema>> merge(HoodieRecord older, Schema oldSc | |||
|
|||
if (newer instanceof HoodieSparkRecord) { | |||
HoodieSparkRecord newSparkRecord = (HoodieSparkRecord) newer; | |||
if (newSparkRecord.isDeleted()) { | |||
if (newSparkRecord.isDelete(newSchema, props)) { |
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.
We better add a UT for the merger.
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.
Ok, I will add a UT for this.
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.
the UT has been added.
c08c321
to
4c37fd3
Compare
4c37fd3
to
6c7a5c1
Compare
|
||
class TestDefaultSparkRecordMerger { | ||
static final String RECORD_KEY_FIELD_NAME = "record_key"; | ||
static final String PARTITION_PATH_FIELD_NAME = "partition_path"; |
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.
I see there are also IT tests: TestHoodieMergeHandleWithSparkMerger
, do we also need to add a test case there?
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.
No. the delete record with hoodieoperation is tested, and the fg reader has been used to read.
* If the input records are not Spark record, it throws. | ||
*/ | ||
@Test | ||
void testMergerWithArvroRecord() { |
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.
nit: avro
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.
Done.
* If the new record is a delete record, the merged record is empty. | ||
*/ | ||
@Test | ||
void testMergerWithNewRecordIsDeleteRecord() throws IOException { |
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.
testMergerWithNewRecordAsDelete ?
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.
Done.
* If the old record is a delete record, the merged record is the new record. | ||
*/ | ||
@Test | ||
void testMergerWithOldRecordIsDeleteRecord() throws IOException { |
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.
testMergerWithOldRecordAsDelete?
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.
Done.
Change Logs
isDeleted()
only checks if the data == null.isDelete()
returns true whenTherefore, remove
isDeleted()
and its underlying variable.Impact
Clean the logic of determining delete record for Spark.
Risk level (write none, low medium or high below)
Medium.
Existing tests should be sufficient.
Documentation Update
Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".
ticket number here and follow the instruction to make
changes to the website.
Contributor's checklist