rdblue commented on code in PR #16595:
URL: https://github.com/apache/iceberg/pull/16595#discussion_r3398917821
##########
core/src/main/java/org/apache/iceberg/util/FileSystemWalker.java:
##########
@@ -112,13 +112,20 @@ public static void listDirRecursivelyWithHadoop(
Consumer<String> directoryConsumer,
Consumer<String> fileConsumer) {
PathFilter pathFilter = PartitionAwareHiddenPathFilter.forSpecs(specs);
+
if (maxDepth <= 0) {
directoryConsumer.accept(dir);
return;
}
+ // Ensure trailing slash for consistent path handling and proper
credential scoping
Review Comment:
Changes aren't needed for `listDirRecursivelyWithHadoop`.
In a Hadoop `FIleSystem`,
[`listStatus`](https://hadoop.apache.org/docs/r3.4.0/api/org/apache/hadoop/fs/FileSystem.html#listStatus-org.apache.hadoop.fs.Path-)
returns the children of a directory node. Here's the Javadoc:
> List the statuses of the files/directories in the given path if the path
is a directory.
That's not a prefix matching operation in Hadoop, it is looking up a node in
the hierarchy, checking that it's a directory, and returning its children. With
that contract, it would make no sense if listing `hdfs:/path/to/table` returned
values under `hdfs:/path/to/table2`. Those are completely different nodes with
names that do not match.
--
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]