[HUDI-2410] Fix getDefaultBootstrapIndexClass logical error (#3633)
This commit is contained in:
@@ -136,10 +136,10 @@ public class HoodieTableConfig extends HoodieConfig implements Serializable {
|
||||
.defaultValue("archived")
|
||||
.withDocumentation("path under the meta folder, to store archived timeline instants at.");
|
||||
|
||||
public static final ConfigProperty<String> BOOTSTRAP_INDEX_ENABLE = ConfigProperty
|
||||
public static final ConfigProperty<Boolean> BOOTSTRAP_INDEX_ENABLE = ConfigProperty
|
||||
.key("hoodie.bootstrap.index.enable")
|
||||
.noDefaultValue()
|
||||
.withDocumentation("Whether or not, this is a bootstrapped table, with bootstrap base data and an mapping index defined.");
|
||||
.defaultValue(true)
|
||||
.withDocumentation("Whether or not, this is a bootstrapped table, with bootstrap base data and an mapping index defined, default true.");
|
||||
|
||||
public static final ConfigProperty<String> BOOTSTRAP_INDEX_CLASS_NAME = ConfigProperty
|
||||
.key("hoodie.bootstrap.index.class")
|
||||
@@ -298,8 +298,9 @@ public class HoodieTableConfig extends HoodieConfig implements Serializable {
|
||||
}
|
||||
|
||||
public static String getDefaultBootstrapIndexClass(Properties props) {
|
||||
HoodieConfig hoodieConfig = new HoodieConfig(props);
|
||||
String defaultClass = BOOTSTRAP_INDEX_CLASS_NAME.defaultValue();
|
||||
if ("false".equalsIgnoreCase(props.getProperty(BOOTSTRAP_INDEX_ENABLE.key()))) {
|
||||
if (!hoodieConfig.getBooleanOrDefault(BOOTSTRAP_INDEX_ENABLE)) {
|
||||
defaultClass = NO_OP_BOOTSTRAP_INDEX_CLASS;
|
||||
}
|
||||
return defaultClass;
|
||||
|
||||
@@ -627,6 +627,7 @@ public class HoodieTableMetaClient implements Serializable {
|
||||
private String partitionFields;
|
||||
private String bootstrapIndexClass;
|
||||
private String bootstrapBasePath;
|
||||
private Boolean bootstrapIndexEnable;
|
||||
private Boolean populateMetaFields;
|
||||
private String keyGeneratorClassProp;
|
||||
|
||||
@@ -702,6 +703,11 @@ public class HoodieTableMetaClient implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public PropertyBuilder setBootstrapIndexEnable(Boolean bootstrapIndexEnable) {
|
||||
this.bootstrapIndexEnable = bootstrapIndexEnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PropertyBuilder setPopulateMetaFields(boolean populateMetaFields) {
|
||||
this.populateMetaFields = populateMetaFields;
|
||||
return this;
|
||||
@@ -749,6 +755,11 @@ public class HoodieTableMetaClient implements Serializable {
|
||||
if (hoodieConfig.contains(HoodieTableConfig.BOOTSTRAP_BASE_PATH)) {
|
||||
setBootstrapBasePath(hoodieConfig.getString(HoodieTableConfig.BOOTSTRAP_BASE_PATH));
|
||||
}
|
||||
|
||||
if (hoodieConfig.contains(HoodieTableConfig.BOOTSTRAP_INDEX_ENABLE)) {
|
||||
setBootstrapIndexEnable(hoodieConfig.getBoolean(HoodieTableConfig.BOOTSTRAP_INDEX_ENABLE));
|
||||
}
|
||||
|
||||
if (hoodieConfig.contains(HoodieTableConfig.PRECOMBINE_FIELD)) {
|
||||
setPreCombineField(hoodieConfig.getString(HoodieTableConfig.PRECOMBINE_FIELD));
|
||||
}
|
||||
@@ -807,6 +818,10 @@ public class HoodieTableMetaClient implements Serializable {
|
||||
tableConfig.setValue(HoodieTableConfig.BOOTSTRAP_INDEX_CLASS_NAME, bootstrapIndexClass);
|
||||
}
|
||||
|
||||
if (null != bootstrapIndexEnable) {
|
||||
tableConfig.setValue(HoodieTableConfig.BOOTSTRAP_INDEX_ENABLE, Boolean.toString(bootstrapIndexEnable));
|
||||
}
|
||||
|
||||
if (null != bootstrapBasePath) {
|
||||
tableConfig.setValue(HoodieTableConfig.BOOTSTRAP_BASE_PATH, bootstrapBasePath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user