Open tiemvanderdeure opened 20 hours ago
Ugh that's a bug, I think its but tricky to calculate without allocating
Is it? Isn't it just the same type of any view over the dimensions we group by?
first(grps) isa typeof(view(da, X = [1])) # true
View may be different to getindex 😭
Guess we need to manually hack it to always be views of the lookups
So manual slicedims
calls or whatever. And some tricky getindex/view dispatch and ambiguity handling
Or maybe we can just always view
even on getindex
. That can just be what a DimGroupByArray is.
I don't know if I totally follow you. Doesn't a DimGroupByArray always contains only views of the original array?
I tracked it down to these lines: https://github.com/rafaqz/DimensionalData.jl/blob/a5585f5470b59ce97652b335a05f6a5d57f0548f/src/dimindices.jl#L307-L311
Where T
becomes the eltype of the DimSlices. By taking the first of the axes you always lose the dimension, but the indices here are vectors of vectors we don't in reality. If I change it to
inds = map(newdims) do idx
rebuild(idx, first(idx))
end
then it works. But that's probably not the actual fix.
Ah right that might be the fix actually, I clearly don't remember how it works 😅
Just stumbled across this and wanted to make sure that it is intentional?
this also breaks the AbstractArray interface, e.g.