SEPURI-SAI-KRISHNA commented on code in PR #19648:
URL: https://github.com/apache/hudi/pull/19648#discussion_r3827277764


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/keygen/PartitionPathFormatterBase.java:
##########
@@ -62,11 +62,28 @@ public final S combine(List<String> partitionPathFields, 
Object... partitionPath
     // Avoid creating [[StringBuilder]] in case there's just one 
partition-path part,
     // and Hive-style of partitioning is not required
     if (!useHiveStylePartitioning && partitionPathParts.length == 1) {
-      if (slashSeparatedDatePartitioning) {
-        return ((S) ((String) toString(partitionPathParts[0])).replace('-', 
'/'));
-      } else {
-        return tryEncode(handleEmpty(toString(partitionPathParts[0])));
-      }
+      S partitionPathPart = 
tryEncode(handleEmpty(toString(partitionPathParts[0])));
+      // NOTE: For [[SimpleKeyGenerator]]/[[ComplexKeyGenerator]] 
slash-separated date partitioning

Review Comment:
   Fair point, done. `combine()` now carries a two-line pointer instead of the 
block:
   
   ```java
   S partitionPathPart = 
tryEncode(handleEmpty(toString(partitionPathParts[0])));
   // NOTE: See [[replaceDashesWithSlashes]] on why the substitution is 
confined to this
   //       single-part branch, and [[startsWithDash]] on why a leading dash 
suppresses it
   return slashSeparatedDatePartitioning && !startsWithDash(partitionPathPart)
       ? replaceDashesWithSlashes(partitionPathPart)
       : partitionPathPart;
   ```
   
   I split the rationale by which method it actually explains rather than 
moving it wholesale: the single-field/`CustomKeyGenerator` half is about when 
`combine()` routes a value into the substitution, so it went onto 
`replaceDashesWithSlashes`; the leading-dash half explains the guard itself, so 
it went onto `startsWithDash` — whose javadoc previously said "must not be 
applied to it" without saying why, which was the weaker of the two docs.
   
   No behavior change, comments only.



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