-
-
Notifications
You must be signed in to change notification settings - Fork 336
Fix DirectoryStore #773
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
Fix DirectoryStore #773
Changes from 1 commit
d26923a
c06476d
ce8b2f0
e183566
449a67f
10c874e
2e4f4d7
cb62c10
68adca5
f2f75b7
88a39ff
a5f1811
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Previous tests (now commented out) used logic in the store classes to convert "0/0" keys into "0.0" keys, forcing the store to be aware of array details. This tries to swap the logic so that stores are responsible for passing dimension separator values down to the arrays only. Since arrays can also get the dimension_separator value from a .zarray file they are now in charge.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1165,10 +1165,10 @@ def test_chunk_nesting(self): | |
# any path where last segment looks like a chunk key gets special handling | ||
store['0.0'] = b'xxx' | ||
assert b'xxx' == store['0.0'] | ||
assert b'xxx' == store['0/0'] | ||
# assert b'xxx' == store['0/0'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we loose there? Doesn't the store normalise "." -> "/" anyway? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to describe in the commit message on e183566, at least to the best of my understanding:
|
||
store['foo/10.20.30'] = b'yyy' | ||
assert b'yyy' == store['foo/10.20.30'] | ||
assert b'yyy' == store['foo/10/20/30'] | ||
# assert b'yyy' == store['foo/10/20/30'] | ||
store['42'] = b'zzz' | ||
assert b'zzz' == store['42'] | ||
|
||
|
@@ -1213,12 +1213,12 @@ def test_chunk_nesting(self): | |
store['0.0'] = b'xxx' | ||
assert '0.0' in store | ||
assert b'xxx' == store['0.0'] | ||
assert b'xxx' == store['0/0'] | ||
# assert b'xxx' == store['0/0'] | ||
store['foo/10.20.30'] = b'yyy' | ||
assert 'foo/10.20.30' in store | ||
assert b'yyy' == store['foo/10.20.30'] | ||
# N5 reverses axis order | ||
assert b'yyy' == store['foo/30/20/10'] | ||
# assert b'yyy' == store['foo/30/20/10'] | ||
store['42'] = b'zzz' | ||
assert '42' in store | ||
assert b'zzz' == store['42'] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain how this change is compatible with
FSStore._normalize_key
? https://github.com/zarr-developers/zarr-python/blob/master/zarr/storage.py#L1076FSStore._normalize_key
assumes that all chunk keys are formattedfoo/bar/0.0.0
-- this assumption is the basis of splitting the chunk key into a prefix and a chunk ID viakey.split('/')
. As I understand it, this change breaks this assumption.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the
flat
andnested
fixtures from this repo (zarr.open(f"file:///tmp/{x}")[:]
) with some sloppy debugging in place shows:which likely points to some logic in FSStore being ripe for removal since the Store is basically just accepting what what the Array has detected. Now, how it is that that's working with your PR, I still haven't figured out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, as your test shows this is fine for FSStore (and maybe we don't need this code in the store at all if the chunk keys come pre-normalized). But this situation is dire for N5Stores, which need to be able to re-order the chunk keys before writing to storage.