xushiyan commented on code in PR #6073:
URL: https://github.com/apache/hudi/pull/6073#discussion_r917416408
##########
hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/HoodieSyncConfig.java:
##########
@@ -56,22 +59,14 @@ public class HoodieSyncConfig extends HoodieConfig {
public static final ConfigProperty<String> META_SYNC_DATABASE_NAME =
ConfigProperty
.key("hoodie.datasource.hive_sync.database")
.defaultValue("default")
+ .withInferFunction(cfg ->
Option.ofNullable(cfg.getString(DATABASE_NAME)))
.withDocumentation("The name of the destination database that we should
sync the hudi table to.");
- // If the table name for the metastore destination is not provided, pick it
up from write or table configs.
- public static final Function<HoodieConfig, Option<String>>
TABLE_NAME_INFERENCE_FUNCTION = cfg -> {
- if (cfg.contains(HoodieTableConfig.HOODIE_WRITE_TABLE_NAME_KEY)) {
- return
Option.of(cfg.getString(HoodieTableConfig.HOODIE_WRITE_TABLE_NAME_KEY));
- } else if (cfg.contains(HoodieTableConfig.HOODIE_TABLE_NAME_KEY)) {
- return Option.of(cfg.getString(HoodieTableConfig.HOODIE_TABLE_NAME_KEY));
- } else {
- return Option.empty();
- }
- };
public static final ConfigProperty<String> META_SYNC_TABLE_NAME =
ConfigProperty
.key("hoodie.datasource.hive_sync.table")
.defaultValue("unknown")
- .withInferFunction(TABLE_NAME_INFERENCE_FUNCTION)
+ .withInferFunction(cfg ->
Option.ofNullable(cfg.getString(HOODIE_WRITE_TABLE_NAME_KEY))
Review Comment:
@codope DataSourceOptions still imports the default value for table name.
2nd thought: `ConfigProperty#setDefaultValue(ConfigProperty)` the current
implementation mandates that to use infer function there should be a default to
fallback, as infer function may return empty option.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]