-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-1284] preCombine all HoodieRecords and update all fields according to orderingVal #2106
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
Closed
Closed
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
6ddb4fc
t
Karl-WangSK 21f0d89
Description: feat: We met performance issue with foo module recently,…
Karl-WangSK c5f47c7
Merge remote-tracking branch 'update_stream/master'
Karl-WangSK 835fce8
feat: update preCombine
Karl-WangSK b548678
add test
Karl-WangSK e6efb8c
update
Karl-WangSK f9e3df9
preCombine all HoodieRecords and update all fields according to order…
Karl-WangSK ec6e8a2
update
Karl-WangSK a9d4831
update
Karl-WangSK de06b54
Merge branch 'master' into HUDI-1284
Karl-WangSK bf5f22b
update
Karl-WangSK ac7940d
Merge branch 'HUDI-1284' of github.com:Karl-WangSK/hudi into HUDI-1284
Karl-WangSK 54e2a08
update
Karl-WangSK 11323b2
Update DataSourceUtils.java
Karl-WangSK 94e9c5c
update
Karl-WangSK b574874
Merge branch 'master' into HUDI-1284
Karl-WangSK f678964
Update AbstractWriteHelper.java
Karl-WangSK cca47ce
update
Karl-WangSK 2e3e799
update
Karl-WangSK a6464f6
update
Karl-WangSK 02a2dfc
update
Karl-WangSK f142420
update
Karl-WangSK 1382b04
update
Karl-WangSK cf1de28
update
Karl-WangSK a75f293
add serializableSchema
Karl-WangSK c855aef
Merge branch 'master' into HUDI-1284
Karl-WangSK d8959f6
update
Karl-WangSK 10aa16c
Merge branch 'HUDI-1284' of github.com:Karl-WangSK/hudi into HUDI-1284
Karl-WangSK 427d0f3
update
Karl-WangSK bf9446f
update
Karl-WangSK d44f9e6
update
Karl-WangSK 2c8c08d
update
Karl-WangSK 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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,9 +19,11 @@ | |
| package org.apache.hudi.table.action.commit; | ||
|
|
||
| import org.apache.hudi.client.WriteStatus; | ||
| import org.apache.hudi.common.config.SerializableSchema; | ||
| import org.apache.hudi.common.model.HoodieKey; | ||
| import org.apache.hudi.common.model.HoodieRecord; | ||
| import org.apache.hudi.common.model.HoodieRecordPayload; | ||
| import org.apache.hudi.common.model.UpdatePrecombineAvroPayload; | ||
| import org.apache.hudi.index.HoodieIndex; | ||
|
|
||
| import org.apache.spark.api.java.JavaRDD; | ||
|
|
@@ -33,8 +35,8 @@ | |
| * | ||
| * @param <T> | ||
| */ | ||
| public class SparkWriteHelper<T extends HoodieRecordPayload,R> extends AbstractWriteHelper<T, JavaRDD<HoodieRecord<T>>, | ||
| JavaRDD<HoodieKey>, JavaRDD<WriteStatus>, R> { | ||
| public class SparkWriteHelper<T extends HoodieRecordPayload, R> extends AbstractWriteHelper<T, JavaRDD<HoodieRecord<T>>, | ||
| JavaRDD<HoodieKey>, JavaRDD<WriteStatus>, R> { | ||
| private SparkWriteHelper() { | ||
| } | ||
|
|
||
|
|
@@ -49,7 +51,7 @@ public static SparkWriteHelper newInstance() { | |
| @Override | ||
| public JavaRDD<HoodieRecord<T>> deduplicateRecords(JavaRDD<HoodieRecord<T>> records, | ||
| HoodieIndex<T, JavaRDD<HoodieRecord<T>>, JavaRDD<HoodieKey>, JavaRDD<WriteStatus>> index, | ||
| int parallelism) { | ||
| int parallelism, SerializableSchema schema) { | ||
| boolean isIndexingGlobal = index.isGlobal(); | ||
| return records.mapToPair(record -> { | ||
| HoodieKey hoodieKey = record.getKey(); | ||
|
|
@@ -58,7 +60,14 @@ public JavaRDD<HoodieRecord<T>> deduplicateRecords(JavaRDD<HoodieRecord<T>> reco | |
| return new Tuple2<>(key, record); | ||
| }).reduceByKey((rec1, rec2) -> { | ||
| @SuppressWarnings("unchecked") | ||
| T reducedData = (T) rec1.getData().preCombine(rec2.getData()); | ||
| T reducedData; | ||
| //To prevent every records from parsing schema | ||
| if (rec2.getData() instanceof UpdatePrecombineAvroPayload) { | ||
|
Contributor
Author
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. Can this prevent old payload impl from calling preCombine(_, schema) ? |
||
| reducedData = schema.getSchema() != null ? (T) rec1.getData().preCombine(rec2.getData(), schema.getSchema()) | ||
| : (T) rec1.getData().preCombine(rec2.getData()); | ||
| } else { | ||
| reducedData = (T) rec1.getData().preCombine(rec2.getData()); | ||
| } | ||
| // we cannot allow the user to change the key or partitionPath, since that will affect | ||
| // everything | ||
| // so pick it from one of the records. | ||
|
|
||
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.