yihua commented on code in PR #6759:
URL: https://github.com/apache/hudi/pull/6759#discussion_r979164209


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieLayoutConfig.java:
##########
@@ -80,8 +83,15 @@ public HoodieLayoutConfig build() {
     }
 
     private void setDefault() {
-      if (layoutConfig.contains(HoodieIndexConfig.INDEX_TYPE.key()) && 
layoutConfig.getString(HoodieIndexConfig.INDEX_TYPE.key()).equals(HoodieIndex.IndexType.BUCKET.name()))
 {
+      if (layoutConfig.contains(HoodieIndexConfig.INDEX_TYPE.key())
+          && 
layoutConfig.getString(HoodieIndexConfig.INDEX_TYPE.key()).equals(HoodieIndex.IndexType.BUCKET.name()))
 {
         layoutConfig.setDefaultValue(LAYOUT_TYPE, 
HoodieStorageLayout.LayoutType.BUCKET.name());
+
+        // Currently, the partitioner of the SIMPLE bucket index is supported 
by SparkBucketIndexPartitioner only.
+        if (layoutConfig.contains(HoodieIndexConfig.BUCKET_INDEX_ENGINE_TYPE)
+            && 
layoutConfig.getString(HoodieIndexConfig.BUCKET_INDEX_ENGINE_TYPE).equals("SIMPLE"))
 {

Review Comment:
   nit: can be simplified as 
`"SIMPLE".equals(layoutConfig.getString(HoodieIndexConfig.BUCKET_INDEX_ENGINE_TYPE))`
 without the `contains` check.



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieLayoutConfig.java:
##########
@@ -80,8 +83,15 @@ public HoodieLayoutConfig build() {
     }
 
     private void setDefault() {
-      if (layoutConfig.contains(HoodieIndexConfig.INDEX_TYPE.key()) && 
layoutConfig.getString(HoodieIndexConfig.INDEX_TYPE.key()).equals(HoodieIndex.IndexType.BUCKET.name()))
 {
+      if (layoutConfig.contains(HoodieIndexConfig.INDEX_TYPE.key())
+          && 
layoutConfig.getString(HoodieIndexConfig.INDEX_TYPE.key()).equals(HoodieIndex.IndexType.BUCKET.name()))
 {
         layoutConfig.setDefaultValue(LAYOUT_TYPE, 
HoodieStorageLayout.LayoutType.BUCKET.name());
+
+        // Currently, the partitioner of the SIMPLE bucket index is supported 
by SparkBucketIndexPartitioner only.
+        if (layoutConfig.contains(HoodieIndexConfig.BUCKET_INDEX_ENGINE_TYPE)
+            && 
layoutConfig.getString(HoodieIndexConfig.BUCKET_INDEX_ENGINE_TYPE).equals("SIMPLE"))
 {
+          layoutConfig.setDefaultValue(LAYOUT_PARTITIONER_CLASS_NAME, 
SIMPLE_BUCKET_LAYOUT_PARTITIONER_CLASS_NAME);

Review Comment:
   Could you add a unit test for this default value overwrite?  You can check 
similar tests in `TestHoodieWriteConfig`.  



-- 
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]

Reply via email to