henrib commented on code in PR #6812:
URL: https://github.com/apache/hive/pull/6812#discussion_r4169754621
##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/FileUtils.java:
##########
@@ -658,4 +658,28 @@ void findNext() throws IOException {
nextFile = null;
}
}
+
+ /**
+ * Checks whether {@code path} is {@code subtree} itself or nested under it,
by walking up
+ * {@code path}'s ancestors looking for a match. Depth-based rather than a
string-prefix
+ * comparison, so it isn't fooled by sibling paths that merely share a
prefix (e.g. {@code /a/bc}
+ * is not within {@code /a/b}).
+ *
+ * @param path the path to check
+ * @param subtree the candidate ancestor, or exact match
+ * @return true if {@code path} equals {@code subtree} or is one of its
descendants
+ */
+ public static boolean isPathWithinSubtree(final Path path, final Path
subtree) {
Review Comment:
Done — ported the four isPathWithinSubtree cases from common's TestFileUtils
into a new metastore-common/.../utils/TestFileUtils.java.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]