You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "timwaizenegger (via GitHub)" <gi...@apache.org> on 2025/05/30 13:44:13 UTC

[PR] LocalFileSystem: let WalkDir return sorted results [arrow-rs-object-store]

timwaizenegger opened a new pull request, #389:
URL: https://github.com/apache/arrow-rs-object-store/pull/389

   addresses https://github.com/apache/arrow-rs-object-store/issues/388
   
   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes https://github.com/apache/arrow-rs-object-store/issues/388
   
   # Rationale for this change
    
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   offset listing is only usable if the list results are sorted. Only then can I use a member of the results I already have, to make another call that continues my listing.
   
   # What changes are included in this PR?
   Adds `sort_by_file_name()` call to `WalkDir` in `list_with_maybe_offset`. As far as I can tell, this is the only change needed to make local file offset listing possible.
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please call them out.
   -->
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] LocalFileSystem: let WalkDir return sorted results [arrow-rs-object-store]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #389:
URL: https://github.com/apache/arrow-rs-object-store/pull/389#issuecomment-2922830949

   list_with_offset is designed for listing everything after a given prefix, this is useful for data lake changelogs among other use-cases where you know you aren't interested in records before some time. I appreciate this isn't sufficient to add pagination, but that doesn't make it useless😅
   
   If you need an ordered output, you will need to fetcy everything and sort, which is ultimately what this PR is proposing always doing and I am pushing back on.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] LocalFileSystem: let WalkDir return sorted results [arrow-rs-object-store]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #389:
URL: https://github.com/apache/arrow-rs-object-store/pull/389#issuecomment-2922483966

   Unfortunately this is a limitation that we can't reliably workaround, some stores such as S3 Express don't return data in sorted order, others don't support it at all. Ultimately list_with_offset is an optimisation for when you want everything after a given prefix.
   
   FWIW #371 adds a way to do pagination, although it intentionally doesn't support filesystems.
   
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] LocalFileSystem: let WalkDir return sorted results [arrow-rs-object-store]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #389:
URL: https://github.com/apache/arrow-rs-object-store/pull/389#discussion_r2115996113


##########
src/local.rs:
##########
@@ -641,6 +641,7 @@ impl LocalFileSystem {
         let walkdir = WalkDir::new(root_path)
             // Don't include the root directory itself
             .min_depth(1)
+            .sort_by_file_name()

Review Comment:
   This will list every file in the directory, sort it, and then return it - at the very least this should be explicitly opt-in as directories can get very large - the standard library APIs are intentionally lazy



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] LocalFileSystem: let WalkDir return sorted results [arrow-rs-object-store]

Posted by "timwaizenegger (via GitHub)" <gi...@apache.org>.
timwaizenegger commented on code in PR #389:
URL: https://github.com/apache/arrow-rs-object-store/pull/389#discussion_r2116042705


##########
src/local.rs:
##########
@@ -641,6 +641,7 @@ impl LocalFileSystem {
         let walkdir = WalkDir::new(root_path)
             // Don't include the root directory itself
             .min_depth(1)
+            .sort_by_file_name()

Review Comment:
   That's true and you don't always need it. But sometimes you absolutely do; offset listing just makes no sense without sorting.
   
   - offset listing: need sorting
   - iterator listing: don't care about sorting, higher perf. without sorting
   
   opt-out could be a good option too given those requirements



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] LocalFileSystem: let WalkDir return sorted results [arrow-rs-object-store]

Posted by "timwaizenegger (via GitHub)" <gi...@apache.org>.
timwaizenegger closed pull request #389: LocalFileSystem: let WalkDir return sorted results
URL: https://github.com/apache/arrow-rs-object-store/pull/389


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org