vinishjail97 commented on code in PR #19869:
URL: https://github.com/apache/hudi/pull/19869#discussion_r3983159817


##########
hudi-common/src/main/java/org/apache/hudi/common/util/ExternalFilePathUtil.java:
##########
@@ -143,7 +175,12 @@ private static String getOriginalFileName(String fileName) 
{
    */
   public static StoragePath getFullPathOfPartition(StoragePath parent, String 
fileName) {
     return getExternalFileGroupPrefix(fileName)
-        .map(prefix -> new StoragePath(parent.toString().substring(0, 
parent.toString().length() - prefix.length() - 1)))
+        .map(prefix -> {
+          String parentPath = parent.toString();
+          checkArgument(parentPath.endsWith(StoragePath.SEPARATOR + prefix),
+              "External file " + fileName + " carries the file group prefix " 
+ prefix + " but its parent " + parentPath + " does not end with it");

Review Comment:
   Fixed in af6ddfa1b5b6, applied your suggestion. `getFullPathOfPartition` now 
uses the `Supplier<String>` overload of `checkArgument`, so the message is only 
built when the check fails.



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