public class ConfigUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static HoodieConfig |
DEFAULT_HUDI_CONFIG_FOR_READER |
static String |
DELTA_STREAMER_CONFIG_PREFIX
Deprecated.
|
static String |
IS_QUERY_AS_RO_TABLE
Config stored in hive serde properties to tell query engine (spark/flink) to
read the table as a read-optimized table when this config is true.
|
static String |
OLD_SCHEMAPROVIDER_CONFIG_PREFIX
Deprecated.
|
static String |
SCHEMAPROVIDER_CONFIG_PREFIX |
static String |
STREAMER_CONFIG_PREFIX |
static String |
TABLE_SERDE_PATH
Config stored in hive serde properties to tell query engine (spark) the
location to read.
|
| Constructor and Description |
|---|
ConfigUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkRequiredConfigProperties(TypedProperties props,
List<ConfigProperty<?>> configPropertyList)
Validates that all
ConfigProperty configs exist in the properties. |
static void |
checkRequiredProperties(TypedProperties props,
List<String> checkPropNames)
Validates that config String keys exist in the properties.
|
static String |
configToString(Map<String,String> config)
Convert map config to key-value string.The format of the config
is a key-value pair just like "k1=v1\nk2=v2\nk3=v3".
|
static boolean |
containsConfigProperty(Map<String,Object> props,
ConfigProperty<?> configProperty)
Whether the properties contain a config.
|
static boolean |
containsConfigProperty(TypedProperties props,
ConfigProperty<?> configProperty)
Whether the properties contain a config.
|
static <T extends Enum<T>> |
enumNames(Class<T> enumType) |
static Map<String,Object> |
filterProperties(TypedProperties props,
List<ConfigProperty<String>> configPropertyList)
Returns filtered properties based on the given
ConfigProperty config list to keep. |
static Set<String> |
getAllConfigKeys(List<ConfigProperty<String>> configPropertyList) |
static boolean |
getBooleanWithAltKeys(Properties props,
ConfigProperty<?> configProperty)
Gets the boolean value for a
ConfigProperty config from properties. |
static int |
getIntWithAltKeys(TypedProperties props,
ConfigProperty<?> configProperty)
Gets the integer value for a
ConfigProperty config from properties. |
static long |
getLongWithAltKeys(TypedProperties props,
ConfigProperty<Long> configProperty)
Gets the long value for a
ConfigProperty config from properties. |
static String |
getOrderingField(Properties properties)
Get ordering field.
|
static String |
getPayloadClass(Properties properties)
Get payload class.
|
static Option<Object> |
getRawValueWithAltKeys(Properties props,
ConfigProperty<?> configProperty)
Gets the raw value for a
ConfigProperty config from properties. |
static HoodieConfig |
getReaderConfigs(StorageConfiguration<?> storageConf) |
static String |
getStringWithAltKeys(Map<String,Object> props,
ConfigProperty<String> configProperty)
Gets the String value for a
ConfigProperty config from a Map. |
static String |
getStringWithAltKeys(TypedProperties props,
ConfigProperty<?> configProperty,
String defaultValue)
Gets the String value for a
ConfigProperty config from properties. |
static String |
getStringWithAltKeys(TypedProperties props,
ConfigProperty<String> configProperty)
Gets the String value for a
ConfigProperty config from properties. |
static String |
getStringWithAltKeys(TypedProperties props,
ConfigProperty<String> configProperty,
boolean useDefaultValue)
Gets the String value for a
ConfigProperty config from properties. |
static String |
getStringWithAltKeys(TypedProperties props,
String key,
String altKey,
String defaultValue)
Gets String value from properties with alternative keys.
|
static TypedProperties |
loadGlobalProperties() |
static void |
removeConfigFromProps(TypedProperties props,
ConfigProperty<?> configProperty)
Removes a
ConfigProperty config from properties. |
static <T extends Enum<T>> |
resolveEnum(Class<T> enumType,
String name)
Case-insensitive resolution of input enum name to the enum type
|
static List<String> |
split2List(String param) |
static Option<String> |
stripPrefix(String prop,
ConfigProperty<String> prefixConfig)
Strips the prefix from a config key.
|
static Map<String,String> |
toMap(String keyValueConfig)
Convert the key-value config to a map.
|
static Map<String,String> |
toMap(String keyValueConfig,
String separator)
Convert the key-value config to a map.
|
public static final String STREAMER_CONFIG_PREFIX
@Deprecated public static final String DELTA_STREAMER_CONFIG_PREFIX
public static final String SCHEMAPROVIDER_CONFIG_PREFIX
@Deprecated public static final String OLD_SCHEMAPROVIDER_CONFIG_PREFIX
public static final String IS_QUERY_AS_RO_TABLE
public static final String TABLE_SERDE_PATH
public static final HoodieConfig DEFAULT_HUDI_CONFIG_FOR_READER
public static String getOrderingField(Properties properties)
public static String getPayloadClass(Properties properties)
public static Map<String,String> toMap(String keyValueConfig)
keyValueConfig - Key-value configs in properties format, i.e., multiple lines of
`key=value`.Map of key-value configs.public static Map<String,String> toMap(String keyValueConfig, String separator)
keyValueConfig - key-value configs in properties format, with defined separator.separator - the separator.Map of key-value configs.public static String configToString(Map<String,String> config)
config - A Map of key-value configs.public static <T extends Enum<T>> T resolveEnum(Class<T> enumType, String name)
public static Option<String> stripPrefix(String prop, ConfigProperty<String> prefixConfig)
ConfigProperty
which can have alternatives. The method strips any matching prefix.public static boolean containsConfigProperty(TypedProperties props, ConfigProperty<?> configProperty)
ConfigProperty exists in the properties, this method returns true.props - Configs in TypedPropertiesconfigProperty - Config to look up.true if exists; false otherwise.public static boolean containsConfigProperty(Map<String,Object> props, ConfigProperty<?> configProperty)
ConfigProperty exists in the properties, this method returns true.props - Configs in MapconfigProperty - Config to look up.true if exists; false otherwise.public static void checkRequiredProperties(TypedProperties props, List<String> checkPropNames)
props - Configs in TypedProperties to validate.checkPropNames - List of String keys that must exist.public static void checkRequiredConfigProperties(TypedProperties props, List<ConfigProperty<?>> configPropertyList)
ConfigProperty configs exist in the properties. For each
ConfigProperty config, if any of the key or alternative keys of the
ConfigProperty exists in the properties, the validation of this config passes.props - Configs in TypedProperties to validate.configPropertyList - List of ConfigProperty configs that must exist.public static Option<Object> getRawValueWithAltKeys(Properties props, ConfigProperty<?> configProperty)
ConfigProperty config from properties. The key and
alternative keys are used to fetch the config.props - Configs in Properties.configProperty - ConfigProperty config to fetch.Option of value if the config exists; empty Option otherwise.public static String getStringWithAltKeys(TypedProperties props, ConfigProperty<String> configProperty)
ConfigProperty config from properties. The key and
alternative keys are used to fetch the config. If the config is not found, an
IllegalArgumentException is thrown.props - Configs in TypedProperties.configProperty - ConfigProperty config of String type to fetch.public static String getStringWithAltKeys(TypedProperties props, ConfigProperty<String> configProperty, boolean useDefaultValue)
ConfigProperty config from properties. The key and
alternative keys are used to fetch the config. If using default value, the default value
of ConfigProperty config, if exists, is returned if the config is not found in
the properties. If not using default value, if the config is not found, an
IllegalArgumentException is thrown.props - Configs in TypedProperties.configProperty - ConfigProperty config of String type to fetch.useDefaultValue - Whether to use default value from ConfigProperty.useDefaultValue is true, returns default String value if there is default value
defined in the ConfigProperty config and null otherwise.public static String getStringWithAltKeys(TypedProperties props, ConfigProperty<?> configProperty, String defaultValue)
ConfigProperty config from properties. The key and
alternative keys are used to fetch the config. The default value as the input of the method
is returned if the config is not found in the properties.props - Configs in TypedProperties.configProperty - ConfigProperty config of String type to fetch.defaultValue - Default value.public static String getStringWithAltKeys(Map<String,Object> props, ConfigProperty<String> configProperty)
ConfigProperty config from a Map. The key
and alternative keys are used to fetch the config. The default value of ConfigProperty
config, if exists, is returned if the config is not found in the properties.props - Configs in Map.configProperty - ConfigProperty config of String type to fetch.ConfigProperty config; null otherwise.public static String getStringWithAltKeys(TypedProperties props, String key, String altKey, String defaultValue)
props - Configs in TypedProperties.key - String key.altKey - Alternative String key.defaultValue - Default String value.public static boolean getBooleanWithAltKeys(Properties props, ConfigProperty<?> configProperty)
ConfigProperty config from properties. The key and
alternative keys are used to fetch the config. The default value of ConfigProperty
config, if exists, is returned if the config is not found in the properties.props - Configs in Properties.configProperty - ConfigProperty config to fetch.ConfigProperty config; false otherwise.public static int getIntWithAltKeys(TypedProperties props, ConfigProperty<?> configProperty)
ConfigProperty config from properties. The key and
alternative keys are used to fetch the config. The default value of ConfigProperty
config, if exists, is returned if the config is not found in the properties.props - Configs in TypedProperties.configProperty - ConfigProperty config to fetch.ConfigProperty config; 0 otherwise.public static long getLongWithAltKeys(TypedProperties props, ConfigProperty<Long> configProperty)
ConfigProperty config from properties. The key and
alternative keys are used to fetch the config. The default value of ConfigProperty
config, if exists, is returned if the config is not found in the properties.props - Configs in TypedProperties.configProperty - ConfigProperty config to fetch.ConfigProperty config; 0 otherwise.public static void removeConfigFromProps(TypedProperties props, ConfigProperty<?> configProperty)
ConfigProperty config from properties. This removes all possible keys
including the alternatives from the properties.props - Configs in TypedProperties.configProperty - ConfigProperty config to remove.public static Map<String,Object> filterProperties(TypedProperties props, List<ConfigProperty<String>> configPropertyList)
ConfigProperty config list to keep.props - Configs in TypedProperties.configPropertyList - List of ConfigProperty configs to keep.Map with ConfigProperty configs to keep.public static Set<String> getAllConfigKeys(List<ConfigProperty<String>> configPropertyList)
configPropertyList - List of ConfigProperty configs to keep.ConfigProperty configs.public static HoodieConfig getReaderConfigs(StorageConfiguration<?> storageConf)
public static TypedProperties loadGlobalProperties()
Copyright © 2024 The Apache Software Foundation. All rights reserved.