WIP: Fix writing compound dtype datasets with a single field#1420
Draft
WIP: Fix writing compound dtype datasets with a single field#1420
Conversation
The compound dtype check in __list_fill__ used `len(dtype) > 1`, which missed single-field compound dtypes (e.g., HERD's keys table). This caused the shape to be computed as 2-D via get_data_shape instead of the correct 1-D `(len(data),)`, producing a shape/maxshape rank mismatch error from h5py. Use `dtype.names is not None` to correctly detect all compound dtypes. Fixes #1419 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1420 +/- ##
==========================================
+ Coverage 92.85% 93.06% +0.21%
==========================================
Files 41 41
Lines 9989 9989
Branches 2054 2054
==========================================
+ Hits 9275 9296 +21
+ Misses 436 417 -19
+ Partials 278 276 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rly
commented
Mar 6, 2026
rly
commented
Mar 6, 2026
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.
Summary
__list_fill__to handle single-field compound dtypes (e.g., HERD'skeystable with dtype[('key', 'O')])len(dtype) > 1missed single-field compound dtypes, causingget_data_shapeto return a 2-D shape that mismatched the 1-Dmaxshape, producing an h5py errordtype.names is not Noneto correctly detect all compound dtypesFixes #1419
Test plan
test_write_dataset_list_single_field_compound_datatype— unit test for writing a single-field compound dtype datasettest_write_herd_as_child— integration test writing/reading HERD as a child group of a container (mirrors the NWB use case)🤖 Generated with Claude Code