[HUDI-2242] Add configuration inference logic for few options (#3359)
Co-authored-by: Wenning Ding <wenningd@amazon.com>
This commit is contained in:
@@ -23,6 +23,8 @@ import org.apache.hudi.common.util.StringUtils;
|
||||
import org.apache.hudi.exception.HoodieException;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -93,8 +95,8 @@ public class ConfigProperty<T> implements Serializable {
|
||||
return inferFunction;
|
||||
}
|
||||
|
||||
public String[] getAlternatives() {
|
||||
return alternatives;
|
||||
public List<String> getAlternatives() {
|
||||
return Arrays.asList(alternatives);
|
||||
}
|
||||
|
||||
public ConfigProperty<T> withDocumentation(String doc) {
|
||||
|
||||
@@ -96,7 +96,7 @@ public class DFSPropertiesConfiguration {
|
||||
try {
|
||||
conf.addPropsFromFile(new Path(DEFAULT_CONF_FILE_DIR));
|
||||
} catch (Exception ignored) {
|
||||
LOG.debug("Didn't find config file under default conf file dir: " + DEFAULT_CONF_FILE_DIR);
|
||||
LOG.warn("Didn't find config file under default conf file dir: " + DEFAULT_CONF_FILE_DIR);
|
||||
}
|
||||
}
|
||||
return conf.getProps();
|
||||
|
||||
@@ -90,7 +90,7 @@ public class HoodieConfig implements Serializable {
|
||||
if (props.containsKey(configProperty.key())) {
|
||||
return true;
|
||||
}
|
||||
return Arrays.stream(configProperty.getAlternatives()).anyMatch(props::containsKey);
|
||||
return configProperty.getAlternatives().stream().anyMatch(props::containsKey);
|
||||
}
|
||||
|
||||
private <T> Option<Object> getRawValue(ConfigProperty<T> configProperty) {
|
||||
|
||||
Reference in New Issue
Block a user