suryaprasanna commented on code in PR #17850:
URL: https://github.com/apache/hudi/pull/17850#discussion_r2851265680


##########
hudi-common/src/main/java/org/apache/hudi/common/util/HoodieTableConfigUtils.java:
##########
@@ -84,4 +85,37 @@ public static HoodieTableVersion 
getTableVersion(HoodieConfig 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
+   * and partitioning style (Hive-style vs non-Hive-style).
+   *
+   * @param cfg HoodieConfig containing table configuration
+   * @return Option containing the inferred PartitionValueExtractor class name
+   */
+  public static Option<String> inferPartitionValueExtractorClass(HoodieConfig 
cfg) {
+    Option<String> partitionFieldsOpt = 
HoodieTableConfig.getPartitionFieldProp(cfg)
+        .or(() -> 
Option.ofNullable(cfg.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME)));
+
+    if (!partitionFieldsOpt.isPresent()) {
+      return Option.of("org.apache.hudi.hive.NonPartitionedExtractor");

Review Comment:
   We thought of clubbing the changes. But I agree it is causing more 
confusion, let me remove the change and I will create a followup PR to address 
that.



-- 
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]

Reply via email to