Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public class HoodieLayoutConfig extends HoodieConfig {
.noDefaultValue()
.withDocumentation("Partitioner class, it is used to distribute data in a specific way.");

private static final String SIMPLE_BUCKET_LAYOUT_PARTITIONER_CLASS_NAME =
"org.apache.hudi.table.action.commit.SparkBucketIndexPartitioner";

private HoodieLayoutConfig() {
super();
}
Expand Down Expand Up @@ -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")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

layoutConfig.setDefaultValue(LAYOUT_PARTITIONER_CLASS_NAME, SIMPLE_BUCKET_LAYOUT_PARTITIONER_CLASS_NAME);
}
}
layoutConfig.setDefaultValue(LAYOUT_TYPE, LAYOUT_TYPE.defaultValue());
}
Expand Down