jonvex commented on code in PR #11131:
URL: https://github.com/apache/hudi/pull/11131#discussion_r1595861415
##########
hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java:
##########
@@ -209,21 +193,7 @@ public static List<String>
getAllPartitionFoldersThreeLevelsDown(HoodieStorage s
* Given a base partition and a partition path, return relative path of
partition path to the base path.
*/
public static String getRelativePartitionPath(Path basePath, Path
fullPartitionPath) {
- basePath = CachingPath.getPathWithoutSchemeAndAuthority(basePath);
- fullPartitionPath =
CachingPath.getPathWithoutSchemeAndAuthority(fullPartitionPath);
-
- String fullPartitionPathStr = fullPartitionPath.toString();
-
- if (!fullPartitionPathStr.startsWith(basePath.toString())) {
- throw new IllegalArgumentException("Partition path \"" +
fullPartitionPathStr
- + "\" does not belong to base-path \"" + basePath + "\"");
- }
-
- int partitionStartIndex = fullPartitionPathStr.indexOf(basePath.getName(),
- basePath.getParent() == null ? 0 :
basePath.getParent().toString().length());
- // Partition-Path could be empty for non-partitioned tables
- return partitionStartIndex + basePath.getName().length() ==
fullPartitionPathStr.length() ? ""
- : fullPartitionPathStr.substring(partitionStartIndex +
basePath.getName().length() + 1);
+ return getRelativePartitionPath(new StoragePath(basePath.toUri()), new
StoragePath(fullPartitionPath.toUri()));
Review Comment:
thats in hadoopfsutils so we can't
##########
hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java:
##########
@@ -635,16 +603,7 @@ public static Long getSizeInMB(long sizeInBytes) {
}
public static Path constructAbsolutePathInHadoopPath(String basePath, String
relativePartitionPath) {
- if (StringUtils.isNullOrEmpty(relativePartitionPath)) {
- return new Path(basePath);
- }
-
- // NOTE: We have to chop leading "/" to make sure Hadoop does not treat it
like
- // absolute path
- String properPartitionPath =
relativePartitionPath.startsWith(PATH_SEPARATOR)
- ? relativePartitionPath.substring(1)
- : relativePartitionPath;
- return constructAbsolutePath(new CachingPath(basePath),
properPartitionPath);
+ return new Path(constructAbsolutePath(basePath,
relativePartitionPath).toUri());
Review Comment:
thats in hadoopfsutils so we can't
--
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]