-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[MINOR] Improve code readability by passing in the fileComparisonsRDD in bloom index #2319
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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.
do you actually see from the Spark UI that its not computed twice? I ask because,
fileComparisonsRDDis not cached and thus even though this is declared only once, during runtime, Spark will lazily recomputefileComparisonsRDDonce for each method that uses it.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 didn't check the Spark UI yet, just a simple analyze the process of data writing. For each batch of records to write, the
SparkHoodieBloomIndex.lookupIndexwas expected to be invoked once so thefileComparisonsRDDshould only be evaluated only once, is there other invocation forSparkHoodieBloomIndex.lookupIndex? Maybe i missed something.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.
So Spark does lazy evaluation of an RDD. If the RDD is not persisted to disk/cache, it simply recomputes it. In this case,
fileComparisonsRDDwould be recomputed twice during runtime. the methodexplodeRecordRDDWithFileComparisons()will only be called once, but it does nothing in practice except "define" the RDD it returns.In contrast, if you notice this line of code at the start of
tagLocationThis caches the incoming recordRDD and thus however many times this RDD is used in the indexing DAG, it will not go to the previous stage. if we did not have the .persist() in here, then everytime an RDD derived off this
recordRDDis needed for a Spark action, it will keep reading from source and compute the recordRDD again.Apologies, if you knew all this already. :) and I am failing to see how this wont happen. but at-least you get my concern with this explanation.
Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks for the explanation, the
recordRDDmay be persisted, but the computation inexplodeRecordRDDWithFileComparisonsstill need to do 2 times, right ? Sorry, i'm not that familiar with theRDDthing.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.
Correct. That's what i think will happen