xushiyan commented on code in PR #6217:
URL: https://github.com/apache/hudi/pull/6217#discussion_r929519658
##########
hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/HoodieSyncConfig.java:
##########
@@ -72,57 +73,51 @@ public class HoodieSyncConfig extends HoodieConfig {
public static final ConfigProperty<String> META_SYNC_BASE_FILE_FORMAT =
ConfigProperty
.key("hoodie.datasource.hive_sync.base_file_format")
.defaultValue("PARQUET")
+ .withInferFunction(cfg ->
Option.ofNullable(cfg.getString(HoodieTableConfig.BASE_FILE_FORMAT)))
.withDocumentation("Base file format for the sync.");
- // If partition fields are not explicitly provided, obtain from the
KeyGeneration Configs
- public static final Function<HoodieConfig, Option<String>>
PARTITION_FIELDS_INFERENCE_FUNCTION = cfg -> {
- if (cfg.contains(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME)) {
- return
Option.of(cfg.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME));
- } else {
- return Option.empty();
- }
- };
public static final ConfigProperty<String> META_SYNC_PARTITION_FIELDS =
ConfigProperty
.key("hoodie.datasource.hive_sync.partition_fields")
.defaultValue("")
- .withInferFunction(PARTITION_FIELDS_INFERENCE_FUNCTION)
+ .withInferFunction(cfg ->
Option.ofNullable(cfg.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME)))
.withDocumentation("Field in the table to use for determining hive
partition columns.");
- // If partition value extraction class is not explicitly provided, configure
based on the partition fields.
- public static final Function<HoodieConfig, Option<String>>
PARTITION_EXTRACTOR_CLASS_FUNCTION = cfg -> {
- if (!cfg.contains(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME)) {
- return Option.of("org.apache.hudi.hive.NonPartitionedExtractor");
- } else {
- int numOfPartFields =
cfg.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME).split(",").length;
- if (numOfPartFields == 1
- && cfg.contains(KeyGeneratorOptions.HIVE_STYLE_PARTITIONING_ENABLE)
- &&
cfg.getString(KeyGeneratorOptions.HIVE_STYLE_PARTITIONING_ENABLE).equals("true"))
{
- return
Option.of("org.apache.hudi.hive.HiveStylePartitionValueExtractor");
- } else {
- return Option.of("org.apache.hudi.hive.MultiPartKeysValueExtractor");
- }
- }
- };
public static final ConfigProperty<String>
META_SYNC_PARTITION_EXTRACTOR_CLASS = ConfigProperty
.key("hoodie.datasource.hive_sync.partition_extractor_class")
.defaultValue("org.apache.hudi.hive.SlashEncodedDayPartitionValueExtractor")
- .withInferFunction(PARTITION_EXTRACTOR_CLASS_FUNCTION)
+ .withInferFunction(cfg -> {
+ if (cfg.contains(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME)) {
+ int numOfPartFields =
cfg.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME).split(",").length;
+ if (numOfPartFields == 1
+ &&
cfg.contains(KeyGeneratorOptions.HIVE_STYLE_PARTITIONING_ENABLE)
+ &&
cfg.getString(KeyGeneratorOptions.HIVE_STYLE_PARTITIONING_ENABLE).equals("true"))
{
+ return
Option.of("org.apache.hudi.hive.HiveStylePartitionValueExtractor");
+ } else {
+ return
Option.of("org.apache.hudi.hive.MultiPartKeysValueExtractor");
+ }
+ } else {
+ return Option.of("org.apache.hudi.hive.NonPartitionedExtractor");
+ }
+ })
.withDocumentation("Class which implements PartitionValueExtractor to
extract the partition values, "
+ "default 'SlashEncodedDayPartitionValueExtractor'.");
public static final ConfigProperty<String> META_SYNC_ASSUME_DATE_PARTITION =
ConfigProperty
.key("hoodie.datasource.hive_sync.assume_date_partitioning")
- .defaultValue("false")
- .withDocumentation("Assume partitioning is yyyy/mm/dd");
+
.defaultValue(HoodieMetadataConfig.ASSUME_DATE_PARTITIONING.defaultValue())
Review Comment:
also "false"
--
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]