rafaqz / DimensionalData.jl

Named dimensions and indexing for julia arrays and other data
https://rafaqz.github.io/DimensionalData.jl/stable/
MIT License
271 stars 38 forks source link

Breaking: indexing corectness fixes #523

Closed rafaqz closed 1 year ago

rafaqz commented 1 year ago

So it turns out there are a bunch of edge cases where indexing is weird.

Indexing a Regular index with an Array returned another Regular index. But it certainly needs to be Irregular.

This PR returns Irregular. That also means we need to get the bounds stored in Irregular right more often, and there were some bugs in that which are also fixed. Handling Not and LogicalIndex` also pose some difficulties this PR resolves.

Probably, we also need to check that an index array is sorted and swap to Unordered if so, or reverse the order if it is sorted in reverse. But for now that is still undefined behavior I will leave for the next PR.

codecov-commenter commented 1 year ago

Codecov Report

Merging #523 (ec5f707) into main (6af9c1e) will increase coverage by 0.21%. The diff coverage is 93.75%.

@@            Coverage Diff             @@
##             main     #523      +/-   ##
==========================================
+ Coverage   89.38%   89.60%   +0.21%     
==========================================
  Files          39       39              
  Lines        2874     2895      +21     
==========================================
+ Hits         2569     2594      +25     
+ Misses        305      301       -4     
Files Changed Coverage Δ
src/interface.jl 100.00% <ø> (ø)
src/LookupArrays/indexing.jl 75.00% <50.00%> (+15.00%) :arrow_up:
src/LookupArrays/lookup_arrays.jl 83.73% <95.45%> (+2.85%) :arrow_up:
src/array/indexing.jl 86.48% <100.00%> (-0.36%) :arrow_down:

... and 2 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more