alexeykudinkin commented on a change in pull request #4333:
URL: https://github.com/apache/hudi/pull/4333#discussion_r771646123
##########
File path:
hudi-common/src/main/java/org/apache/hudi/common/fs/inline/InLineFSUtils.java
##########
@@ -74,40 +75,50 @@ public static Path getInlineFilePath(Path outerPath, String
origScheme, long inL
* @return Outer file Path from the InLineFS Path
*/
public static Path getOuterFilePathFromInlinePath(Path inlineFSPath) {
- final String scheme = inlineFSPath.getParent().getName();
+ assertInlineFSPath(inlineFSPath);
+
+ final String baseFileScheme = inlineFSPath.getParent().getName();
final Path basePath = inlineFSPath.getParent().getParent();
-
ValidationUtils.checkArgument(basePath.toString().contains(SCHEME_SEPARATOR),
- "Invalid InLineFSPath: " + inlineFSPath);
+ checkArgument(
+ basePath.toString().contains(SCHEME_SEPARATOR),
+ "Invalid InLineFS path: " + inlineFSPath);
final String pathExceptScheme =
basePath.toString().substring(basePath.toString().indexOf(SCHEME_SEPARATOR) +
1);
- final String fullPath = scheme + SCHEME_SEPARATOR
- + (scheme.equals(LOCAL_FILESYSTEM_SCHEME) ? PATH_SEPARATOR : "")
+ final String fullPath = baseFileScheme + SCHEME_SEPARATOR
+ + (baseFileScheme.equals(LOCAL_FILESYSTEM_SCHEME) ? PATH_SEPARATOR :
"")
+ pathExceptScheme;
return new Path(fullPath);
}
/**
- * Eg input : "inlinefs://file1/s3a/?start_offset=20&length=40".
- * output: 20
+ * Returns start offset w/in the base for the block identified by the given
InlineFS path
*
- * @param inlinePath
- * @return
+ * input: "inlinefs://file1/s3a/?start_offset=20&length=40".
+ * output: 20
*/
- public static int startOffset(Path inlinePath) {
- String[] slices = inlinePath.toString().split("[?&=]");
+ public static int startOffset(Path inlineFSPath) {
+ assertInlineFSPath(inlineFSPath);
Review comment:
Assertion would provide clear failure point, and it's a cheap check to
make (we just compare schemes)
--
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]