Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2668 +/- ##
==========================================
- Coverage 87.62% 85.81% -1.82%
==========================================
Files 49 49
Lines 8129 8140 +11
==========================================
- Hits 7123 6985 -138
- Misses 1006 1155 +149
|
|
if I understand correctly, the issue raised in #2576 also occurs on case-sensitive filesystems - see https://github.com/d-v-b/zarr-python/pull/273 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2576.
Diagnosis
write_zarrstores everyobs/varcolumn as a zarr member named after the column. When two column names differ only by case (Studyandstudy), that only works on a case-sensitive filesystem. On a case-insensitive one — macOS' default APFS, Windows, exFAT — both names address the same member, so the second write silently overwrites the first. The consolidated metadata then only records the name that won, whilecolumn-orderstill lists both, andread_zarrdies inside zarr while resolving the missing name:I reproduced this on both sides of the filesystem boundary to confirm the mechanism, so this is not the pandas concat / axis-name collision the traceback suggests:
obs/fooin consolidated metadataread_zarrKeyError: "'foo' not found in consolidated metadata."Same result across zarr 3.1.3, 3.2.1, 3.3.0 and 3.4.0, so no zarr version fixes it — the collision happens in the store, below zarr's view.
consolidate_metadata=Falseonly masks it: the metadata is no longer consulted, so the surviving column reads back fine while the overwritten one is silently gone..h5adis unaffected in both directions, since HDF5 keys are not filesystem paths.Fix
write_dataframenow warns when the columns it is about to write collide understr.casefold(), for zarr groups only:A warning rather than an error, because the destination decides whether the names actually collide: the same
write_zarrcall is correct on ext4 or in an S3-backed store, and only becomes lossy on a case-insensitive volume. Failing there would break working code, and the data is already unrecoverable at that point, so the useful moment to say something is on write.Tests
test_dataframe_columns_differing_by_casecovers both formats: the zarr case asserts the warning and that the frame still roundtrips, the h5ad case asserts silence, since only the zarr member layout is at risk.test_dataframe_columns_differing_by_case_dont_warnguards against over-firing on names that are merely a prefix of one another (study/StudyID).