Skip to content

Fix single-row compound datasets with references being flattened#338

Open
bendichter wants to merge 1 commit into
unified-zarr-conventionfrom
fix-single-row-compound-ref
Open

Fix single-row compound datasets with references being flattened#338
bendichter wants to merge 1 commit into
unified-zarr-conventionfrom
fix-single-row-compound-ref

Conversation

@bendichter

Copy link
Copy Markdown
Contributor

Summary

Override shape property on AbstractZarrTableDataset to return None instead of the raw zarr array shape. This prevents hdmf's objectmapper from treating single-row compound datasets as scalars and unwrapping data[0] into a flat row.

Root cause

hdmf's ObjectMapper.__get_subspec_values unwraps builder.data when shape == (1,) and data[0] is not np.void. For BuilderZarrTableDataset, this replaces the lazy wrapper with a flat row [val1, val2, GroupBuilder], causing a column length mismatch in DynamicTable.__init__.

Fix

Return None for shape on compound table datasets so the scalar unwrap is never triggered.

Test plan

  • Extended icephys tutorial reads via both Zarr conversion and zindi
  • All 448 tests pass

Fixes #337

🤖 Generated with Claude Code

Override shape property on AbstractZarrTableDataset to return None
instead of the raw zarr array shape. This prevents hdmf's objectmapper
from treating single-row compound datasets as scalars and unwrapping
data[0] into a flat row [val1, val2, ref], which caused a column
length mismatch error in DynamicTable construction.

Fixes #337

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Mar 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.04%. Comparing base (6ddd957) to head (086903f).
⚠️ Report is 2 commits behind head on unified-zarr-convention.

Files with missing lines Patch % Lines
src/hdmf_zarr/zarr_utils.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           unified-zarr-convention     #338      +/-   ##
===========================================================
- Coverage                    82.08%   82.04%   -0.04%     
===========================================================
  Files                            5        5              
  Lines                         1423     1426       +3     
  Branches                       298      298              
===========================================================
+ Hits                          1168     1170       +2     
- Misses                         168      169       +1     
  Partials                        87       87              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants