Skip to content
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: sharding codec with fancy indexing #2817

Merged
merged 8 commits into from
Feb 13, 2025
Merged

Conversation

LDeakin
Copy link
Contributor

@LDeakin LDeakin commented Feb 11, 2025

Fixes #2816

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.rst
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Feb 11, 2025
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Feb 11, 2025
@d-v-b
Copy link
Contributor

d-v-b commented Feb 12, 2025

thanks, this looks great. For posterity, could you explain what the bug was exactly? I don't actually remember offhand what fancy indexing is, so the logic of the fix isn't immediately obvious to me.

@dcherian dcherian mentioned this pull request Feb 12, 2025
4 tasks
Copy link
Contributor

@dcherian dcherian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work.

#2822 passes when run with this PR merged

@LDeakin
Copy link
Contributor Author

LDeakin commented Feb 13, 2025

thanks, this looks great. For posterity, could you explain what the bug was exactly? I don't actually remember offhand what fancy indexing is, so the logic of the fix isn't immediately obvious to me.

The hint I had for fixing this one was this comment:

# remember shape of selection, because we will flatten indices for processing
sel_shape = selection_broadcast[0].shape or (1,)

But CoordinateIndexer.sel_shape was not actually being used for unflattening in the sharding codec. This indexer specifically does a type of fancy/advanced indexing called inner/vectorised indexing.

@d-v-b d-v-b merged commit 870265a into zarr-developers:main Feb 13, 2025
30 checks passed
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.

ValueError when indexing into sharded array
3 participants