This is an automated email from the ASF dual-hosted git repository.
voonhous pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new 2566ab6847dd refactor(common): drop stale HoodieTableConfigUtils
copies (#20051)
2566ab6847dd is described below
commit 2566ab6847ddbe46ac54236a3800d68f3a47dd85
Author: voonhous <[email protected]>
AuthorDate: Fri Sep 25 17:27:28 2026 +0800
refactor(common): drop stale HoodieTableConfigUtils copies (#20051)
HoodieTableConfigUtils carries five partition-field statics that
#11601 moved into HoodieTableConfig and deleted; #11866 brought the
file back. The copies have no callers and missed later fixes (#11710,
#18423). Keep only inferPartitionValueExtractorClass.
---
.../hudi/common/util/HoodieTableConfigUtils.java | 63 ----------------------
1 file changed, 63 deletions(-)
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/util/HoodieTableConfigUtils.java
b/hudi-common/src/main/java/org/apache/hudi/common/util/HoodieTableConfigUtils.java
index bc4db3789093..7772d920bdc5 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/util/HoodieTableConfigUtils.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/util/HoodieTableConfigUtils.java
@@ -19,72 +19,9 @@ package org.apache.hudi.common.util;
import org.apache.hudi.common.config.HoodieConfig;
import org.apache.hudi.common.table.HoodieTableConfig;
-import org.apache.hudi.common.table.HoodieTableVersion;
-import org.apache.hudi.keygen.BaseKeyGenerator;
import org.apache.hudi.keygen.constant.KeyGeneratorOptions;
-import java.util.Arrays;
-import java.util.stream.Collectors;
-
public class HoodieTableConfigUtils {
- /**
- * This function returns the partition fields joined by
BaseKeyGenerator.FIELD_SEPARATOR. It will also
- * include the key generator partition type with the field. The key
generator partition type is used for
- * Custom Key Generator.
- */
- public static Option<String>
getPartitionFieldPropForKeyGenerator(HoodieConfig config) {
- return
Option.ofNullable(config.getString(HoodieTableConfig.PARTITION_FIELDS));
- }
-
- /**
- * This function returns the partition fields joined by
BaseKeyGenerator.FIELD_SEPARATOR. It will
- * strip the partition key generator related info from the fields.
- */
- public static Option<String> getPartitionFieldProp(HoodieConfig config) {
- if (getTableVersion(config).greaterThan(HoodieTableVersion.SEVEN)) {
- // With table version eight, the table config
org.apache.hudi.common.table.HoodieTableConfig.PARTITION_FIELDS
- // stores the corresponding partition type as well. This partition type
is useful for CustomKeyGenerator
- // and CustomAvroKeyGenerator.
- return getPartitionFields(config).map(fields ->
String.join(BaseKeyGenerator.FIELD_SEPARATOR, fields));
- } else {
- return
Option.ofNullable(config.getString(HoodieTableConfig.PARTITION_FIELDS));
- }
- }
-
- /**
- * This function returns the partition fields only. This method strips the
key generator related
- * partition key types from the configured fields.
- */
- public static Option<String[]> getPartitionFields(HoodieConfig config) {
- if (HoodieConfig.contains(HoodieTableConfig.PARTITION_FIELDS, config)) {
- return
Option.of(Arrays.stream(config.getString(HoodieTableConfig.PARTITION_FIELDS).split(","))
- .filter(p -> !p.isEmpty())
- .map(p -> getPartitionFieldWithoutKeyGenPartitionType(p, config))
- .collect(Collectors.toList()).toArray(new String[] {}));
- }
- return Option.empty();
- }
-
- /**
- * This function returns the partition fields only. The input partition
field would contain partition
- * type corresponding to the custom key generator if table version is eight
and if custom key
- * generator is configured. This function would strip the partition type and
return the partition field.
- */
- public static String getPartitionFieldWithoutKeyGenPartitionType(String
partitionField, HoodieConfig config) {
- return getTableVersion(config).greaterThan(HoodieTableVersion.SEVEN)
- ?
partitionField.split(BaseKeyGenerator.CUSTOM_KEY_GENERATOR_SPLIT_REGEX)[0]
- : partitionField;
- }
-
- /**
- * This function returns the hoodie.table.version from hoodie.properties
file.
- */
- public static HoodieTableVersion getTableVersion(HoodieConfig config) {
- return HoodieConfig.contains(HoodieTableConfig.VERSION, config)
- ?
HoodieTableVersion.fromVersionCode(config.getInt(HoodieTableConfig.VERSION))
- : HoodieTableConfig.VERSION.defaultValue();
- }
-
/**
* Infers the appropriate PartitionValueExtractor class based on table
configuration.
* This function determines the correct extractor based on the number of
partition fields