[HUDI-6217] Spark reads should skip record with delete operation metadata#10219
Merged
danny0405 merged 2 commits intoapache:masterfrom Dec 2, 2023
Merged
[HUDI-6217] Spark reads should skip record with delete operation metadata#10219danny0405 merged 2 commits intoapache:masterfrom
danny0405 merged 2 commits intoapache:masterfrom
Conversation
danny0405
reviewed
Dec 1, 2023
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/Iterators.scala
Outdated
Show resolved
Hide resolved
danny0405
reviewed
Dec 1, 2023
| } else { | ||
| val mergedRecordOpt = merge(curRow, updatedRecordOpt.get) | ||
| if (mergedRecordOpt.isEmpty) { | ||
| if (mergedRecordOpt.orNull == null) { |
Contributor
Author
There was a problem hiding this comment.
In the last commit, Some(null) might appear here if it's delete operation.
To better readable, I update the pr in the latest commit to change optional.map to optional.flatmap to avoid Some(null).
danny0405
reviewed
Dec 1, 2023
| projection.apply(r.getLeft.getData.asInstanceOf[InternalRow]) | ||
| val data = r.getLeft.getData.asInstanceOf[InternalRow] | ||
| if (isDeleteData(data)) { | ||
| null |
Contributor
There was a problem hiding this comment.
Isn't the return type an option ?
Contributor
Author
There was a problem hiding this comment.
It's the return type of optional.map function.
To better readable, I update the pr in the latest commit to change optional.map to optional.flatmap to avoid Some(null).
Collaborator
danny0405
approved these changes
Dec 2, 2023
Member
|
@beyond1920 Hi,Thanks for the pr,we also occur the problem,and query only miss scenario of delete operation?such as insert or update data missing was not occur? |
Contributor
Author
|
Hi, @xuzifu666 , sorry, I didn't understand. What's the question? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Logs
Currently Spark would read the deleted data whose _hoodie_operation is D, which is unexpected.
See more detail in HUDI-6217.
The pr aims to fix the bug.
Impact
None
Risk level (write none, low medium or high below)
None
Documentation Update
Describe any necessary documentation update if there is any new feature, config, or user-facing change
ticket number here and follow the instruction to make
changes to the website.
Contributor's checklist