-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LocalFileSystem list
operation returns objects in wrong order
#6375
Comments
Hi, this behavior is expected. We can't perform sorting over the LocalFileSystem since we don't have such an API, and we can't collect keys and sort them in-memory. The best we can do is return objects in the order that the filesystem provides. |
@Xuanwo I see. Would it make sense to have sorting behavior as optional? Intended only for small stores that fin in memory? |
Another potential option is to implement your own wrapper over like struct SortedLocalFileSystem {
inner: LocalFileSystem
}
impl ObjectStore for SortedLocalFileSystem {
// in the implementation you could intercept the various calls and implement
// whatever behavior you wanted
} |
Sorry, but it doesn't make sense to me now. If you care about the order, you can implement something like what @alamb mentioned, which should be simple.
The most interesting part is this: we don't know how many items there are until we list them all. This inconsistent behavior based on item size might introduce more issues. For example, users might find the object_store behaves one way when there are only 10 items, but differently in production services.
arrow-rs/object_store/src/lib.rs Lines 716 to 721 in 7a5155c
No guarantee has been provided so far. |
Thanks for the quick responses. Closing this. |
Describe the bug
The
LocalFileSystem
list
implementation returns objects in what looks like arbitrary order.S3's
ListObjectsV2
returns objects in lexicographical order of their keys:To Reproduce
The following code fails the assertion:
Expected behavior
LocalFileSystem
should mimic whatListObjectsV2
does, returning objects in lexicographical order of their keys.Additional context
InMemory
doesn't fail this test.The text was updated successfully, but these errors were encountered: