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

Remove unused IdxMap type parameter from ShapedAxis #244

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

LilithHafner
Copy link
Contributor

As I was reviewing the subtypes of AbstractAxis to try to get a better understanding of how ComponentArrays work, I couldn't figure out the point of the IdxMap type parameter in ShapedAxis, so I decided to remove it and see what breaks....

But all the tests pass without this type parameter, so maybe we can just remove it? It seems to me that the index mapping is tracked at the level of the axis containing the ShapedAxis. For example, in

julia> typeof(ComponentArray(a=7, b=rand(2,2)))
ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(a = 1, b = ViewAxis(2:5, ShapedAxis((2, 2), NamedTuple())))}}}

the indices of the matrix are tracked by the ViewAxis, not the ShapedAxis.

I changed the supertype from AbstractAxis{NamedTuple()} to AbstractAxis{nothing} because nothing seems like a better indicator of "there's no index information available".

(I also accidentally removed some trailing whitespace, happy to revert that NFC change if desired)

@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (35221bd) 73.92% compared to head (0a18438) 73.88%.

Files Patch % Lines
src/show.jl 25.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #244      +/-   ##
==========================================
- Coverage   73.92%   73.88%   -0.04%     
==========================================
  Files          23       23              
  Lines         744      743       -1     
==========================================
- Hits          550      549       -1     
  Misses        194      194              

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

@jonniedie
Copy link
Owner

Oh wow. I didn't realize we weren't testing this. That's supposed to exist for components that are multi-dimensional arrays of componentarrays. Which, maybe that's also just a thing that nobody needs.

@LilithHafner
Copy link
Contributor Author

In addition to being untested, I think that behavior has a broken constructor. Specifically, components that are multidimensional arrays of component arrays are automatically flattened to single dimensional arrays of component arrays.

A = fill(ComponentArray(x = 3), 2, 2);
B = fill(4, 2, 2)
C = ComponentArray(A = A, B = B);
(size(A), size(B), size(C.A), size(C.B)) === ((2, 2), (2, 2), (4,), (2, 2))
(eltype(A), eltype(B), eltype(C.A), eltype(C.B)) === (
    ComponentVector{Int64, Vector{Int64}, Tuple{Axis{(x = 1,)}}}, 
    Int64, 
    Any, 
    Int64)

@jonniedie
Copy link
Owner

Ah. Okay well if it's been broken this whole time and nobody's noticed it, then yeah, let's just get rid of it.

@jonniedie jonniedie merged commit 404fca1 into jonniedie:main Feb 25, 2024
6 of 8 checks passed
@LilithHafner LilithHafner deleted the lh/remove-shaped-index-map branch February 25, 2024 17:17
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.

3 participants