danny0405 commented on code in PR #10917:
URL: https://github.com/apache/hudi/pull/10917#discussion_r1536959896
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/HoodieTable.java:
##########
@@ -1096,11 +1104,37 @@ private Set<String> getDropPartitionColNames() {
return new HashSet<>(Arrays.asList(partitionFields.get()));
}
- public void runMerge(HoodieMergeHandle<?, ?, ?, ?> upsertHandle, String
instantTime, String fileId) throws IOException {
+ public Iterator<List<WriteStatus>> handleUpdate(String instantTime, String
partitionPath, String fileId,
+ Map<String, HoodieRecord<T>>
keyToNewRecords, HoodieBaseFile oldDataFile) throws IOException {
+ HoodieMergeHandle upsertHandle = getUpdateHandle(instantTime,
partitionPath, fileId, keyToNewRecords, oldDataFile);
+ return updateWithUpsertHandle(upsertHandle, instantTime, fileId);
+ }
+
+ public Iterator<List<WriteStatus>>
updateWithUpsertHandle(HoodieMergeHandle<?, ?, ?, ?> upsertHandle, String
instantTime, String fileId) throws IOException {
+ runMerge(upsertHandle, instantTime, fileId);
+ return upsertHandle.getWriteStatusesAsIterator();
+ }
+
+ protected void runMerge(HoodieMergeHandle<?, ?, ?, ?> upsertHandle, String
instantTime, String fileId) throws IOException {
if (upsertHandle.getOldFilePath() == null) {
throw new HoodieUpsertException("Error in finding the old file path at
commit " + instantTime + " for fileId: " + fileId);
} else {
HoodieMergeHelper.newInstance().runMerge(this, upsertHandle);
}
}
+
+ protected HoodieMergeHandle getUpdateHandle(String instantTime, String
partitionPath, String fileId,
Review Comment:
Not sure we should move these handle methods into `HoodieTable` because it
is a top level notion, the current API already includes `upsert` operation
method on this class. These overall "handle" related methods are kind of
internal and I kind of think they do not belongs to the `HoodieTable` interface.
And is there any possibility the three methods `runMerge`,
`updateWithUpsertHandle` and `handleUpdate` be merged into one method?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]