Skip to content

fix: NdMapping explicit tuple set slicing with dimension values#6780

Draft
hoxbro wants to merge 4 commits intomainfrom
fix_slice_fail
Draft

fix: NdMapping explicit tuple set slicing with dimension values#6780
hoxbro wants to merge 4 commits intomainfrom
fix_slice_fail

Conversation

@hoxbro
Copy link
Member

@hoxbro hoxbro commented Jan 20, 2026

Fixes #4900

Handle the case for NdMapping when the values of a slice are tuples.

When slicing a DynamicMap with explicit tuple sets like `dmap[{(1, 0.3)}]`,
the operation failed with ValueError if any kdim had `values` defined.

The parent NdMapping.__getitem__ doesn't handle explicit tuple sets correctly
when dim.values is set. Fix by building the cache dict directly when both
`sample=True` (explicit tuple set) and any kdim has values defined, bypassing
the parent's slicing logic.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.24%. Comparing base (2efdb8f) to head (22e8754).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6780   +/-   ##
=======================================
  Coverage   89.23%   89.24%           
=======================================
  Files         340      340           
  Lines       73196    73229   +33     
=======================================
+ Hits        65316    65352   +36     
+ Misses       7880     7877    -3     

☔ 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.

@hoxbro hoxbro changed the title fix: DynamicMap explicit tuple set slicing with dimension values fix: NdMapping explicit tuple set slicing with dimension values Jan 30, 2026
@hoxbro hoxbro marked this pull request as ready for review January 30, 2026 14:12
@hoxbro hoxbro marked this pull request as draft January 31, 2026 09:14
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.

DynamicMap explicit set slicing fails with value dimensions

2 participants