[HUDI-2734] Setting default metadata enable as false for Java (#4003)
This commit is contained in:
committed by
GitHub
parent
f715cf607f
commit
2d3f2a3275
@@ -18,6 +18,9 @@
|
||||
|
||||
package org.apache.hudi.common.config;
|
||||
|
||||
import org.apache.hudi.common.engine.EngineType;
|
||||
import org.apache.hudi.exception.HoodieNotSupportedException;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
import java.io.File;
|
||||
@@ -163,6 +166,7 @@ public final class HoodieMetadataConfig extends HoodieConfig {
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private EngineType engineType = EngineType.SPARK;
|
||||
private final HoodieMetadataConfig metadataConfig = new HoodieMetadataConfig();
|
||||
|
||||
public Builder fromFile(File propertiesFile) throws IOException {
|
||||
@@ -233,10 +237,28 @@ public final class HoodieMetadataConfig extends HoodieConfig {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withEngineType(EngineType engineType) {
|
||||
this.engineType = engineType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HoodieMetadataConfig build() {
|
||||
metadataConfig.setDefaultValue(ENABLE, getDefaultMetadataEnable(engineType));
|
||||
metadataConfig.setDefaults(HoodieMetadataConfig.class.getName());
|
||||
return metadataConfig;
|
||||
}
|
||||
|
||||
private boolean getDefaultMetadataEnable(EngineType engineType) {
|
||||
switch (engineType) {
|
||||
case SPARK:
|
||||
return ENABLE.defaultValue();
|
||||
case FLINK:
|
||||
case JAVA:
|
||||
return false;
|
||||
default:
|
||||
throw new HoodieNotSupportedException("Unsupported engine " + engineType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user