You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "beyond1920 (via GitHub)" <gi...@apache.org> on 2023/03/03 08:17:00 UTC

[GitHub] [hudi] beyond1920 commented on a diff in pull request #8072: [HUDI-5857] Insert overwrite into bucket table would generate new file group id

beyond1920 commented on code in PR #8072:
URL: https://github.com/apache/hudi/pull/8072#discussion_r1124143958


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/SparkInsertOverwriteCommitActionExecutor.java:
##########
@@ -65,9 +70,21 @@ public HoodieWriteMetadata<HoodieData<WriteStatus>> execute() {
 
   @Override
   protected Partitioner getPartitioner(WorkloadProfile profile) {
-    return table.getStorageLayout().layoutPartitionerClass()
-        .map(c -> getLayoutPartitioner(profile, c))
-        .orElse(new SparkInsertOverwritePartitioner(profile, context, table, config));
+    // Fix HUDI-5857, insert overwrite should generate new file group id
+    if (config.getIndexType().equals(BUCKET)) {
+      switch (config.getBucketIndexEngineType()) {
+        case SIMPLE:
+          return new SparkInsertOverwriteSimpleBucketIndexPartitioner(profile, context, table, config);
+        case CONSISTENT_HASHING:
+          return new SparkInsertOverwriteConsistentBucketIndexPartitioner(profile, context, table, config);
+        default:
+          throw new HoodieNotSupportedException("Unknown bucket index engine type: " + config.getBucketIndexEngineType());

Review Comment:
   I move part of them which related to `ConsistentBucketIndex`  to `SparkInsertOverwritePartitioner`.
   And I left other part which related to `SimpleBucketIndex` in `SparkBucketIndexInsertOverwritePartitioner`.
   Because SimpleBucketIndex and ConsistentBucketIndex are different when creates new `BucketInfo`.
   



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org