-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-9591] FG reader based merge handle for COW merge #13580
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
Changes from 9 commits
c3c38cf
2861d0b
0657b9f
172ef47
a8d862f
e10caf4
a16e427
1835315
60ea304
79e9f89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| package org.apache.hudi.table.action.commit; | ||
|
|
||
| import org.apache.hudi.client.utils.SparkPartitionUtils; | ||
| import org.apache.hudi.common.engine.HoodieReaderContext; | ||
| import org.apache.hudi.index.HoodieSparkIndexClient; | ||
| import org.apache.hudi.client.WriteStatus; | ||
| import org.apache.hudi.client.clustering.update.strategy.SparkAllowUpdateStrategy; | ||
|
|
@@ -47,6 +48,7 @@ | |
| import org.apache.hudi.exception.HoodieUpsertException; | ||
| import org.apache.hudi.execution.SparkLazyInsertIterable; | ||
| import org.apache.hudi.index.HoodieIndex; | ||
| import org.apache.hudi.io.FileGroupReaderBasedMergeHandle; | ||
| import org.apache.hudi.io.HoodieMergeHandle; | ||
| import org.apache.hudi.io.CreateHandleFactory; | ||
| import org.apache.hudi.io.HoodieMergeHandleFactory; | ||
|
|
@@ -176,7 +178,7 @@ public HoodieWriteMetadata<HoodieData<WriteStatus>> execute(HoodieData<HoodieRec | |
| LOG.info("RDD PreppedRecords was persisted at: {}", inputRDD.getStorageLevel()); | ||
| } | ||
|
|
||
| // Handle records update with clustering | ||
| // Handle records update with clustering. | ||
| HoodieData<HoodieRecord<T>> inputRecordsWithClusteringUpdate = clusteringHandleUpdate(inputRecords); | ||
| LOG.info("Num spark partitions for inputRecords before triggering workload profile {}", inputRecordsWithClusteringUpdate.getNumPartitions()); | ||
|
|
||
|
|
@@ -387,8 +389,17 @@ public Iterator<List<WriteStatus>> handleUpdate(String partitionPath, String fil | |
| } | ||
|
|
||
| protected HoodieMergeHandle getUpdateHandle(String partitionPath, String fileId, Iterator<HoodieRecord<T>> recordItr) { | ||
| HoodieMergeHandle mergeHandle = HoodieMergeHandleFactory.create(operationType, config, instantTime, table, recordItr, partitionPath, fileId, | ||
| taskContextSupplier, keyGeneratorOpt); | ||
| HoodieMergeHandle mergeHandle; | ||
| if (config.getMergeHandleClassName().equals(FileGroupReaderBasedMergeHandle.class.getName())) { | ||
|
Contributor
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 does not take effect unless we switch the default value for HoodieWriteConfig.MERGE_HANDLE_CLASS_NAME config property.
Collaborator
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. yes, I updated it. |
||
| HoodieReaderContext<T> readerContext = | ||
| table.getContext().<T>getReaderContextFactory(table.getMetaClient()).getContext(); | ||
| mergeHandle = new FileGroupReaderBasedMergeHandle( | ||
| config, instantTime, table, Option.of(recordItr), partitionPath, fileId, taskContextSupplier, keyGeneratorOpt, | ||
| readerContext, instantTime, table.getConfig().getRecordMerger().getRecordType(), Option.empty()); | ||
| } else { | ||
| mergeHandle = HoodieMergeHandleFactory.create( | ||
| operationType, config, instantTime, table, recordItr, partitionPath, fileId, taskContextSupplier, keyGeneratorOpt); | ||
| } | ||
| if (mergeHandle.getOldFilePath() != null && mergeHandle.baseFileForMerge().getBootstrapBaseFile().isPresent()) { | ||
| Option<String[]> partitionFields = table.getMetaClient().getTableConfig().getPartitionFields(); | ||
| Object[] partitionValues = SparkPartitionUtils.getPartitionFieldVals(partitionFields, mergeHandle.getPartitionPath(), | ||
|
|
||
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 should fix the
HoodieMergeHandleFactoryinstead of here.