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

Attempt to add support for getindex(::DiskArray, Int[]) #194

Merged
merged 6 commits into from
Oct 18, 2024

Conversation

charleskawczynski
Copy link
Contributor

Closes #186.

I'm running into some code paths that I'm not sure how to fix. The current error (in the added test suite) is:

julia> a[Int[]]
ERROR: ArgumentError: Indices can only be omitted for trailing singleton dimensions
Stacktrace:
 [1] _resolve_indices
   @ ~/Dropbox/Caltech/work/dev/clones/forks/DiskArrays.jl/src/diskarray.jl:111 [inlined]
 [2] _resolve_indices
   @ ~/Dropbox/Caltech/work/dev/clones/forks/DiskArrays.jl/src/diskarray.jl:97 [inlined]
 [3] resolve_indices
   @ ~/Dropbox/Caltech/work/dev/clones/forks/DiskArrays.jl/src/diskarray.jl:44 [inlined]
 [4] resolve_indices(a::AccessCountDiskArray{…}, i::Tuple{…}, batchstrategy::DiskArrays.NoBatch{…})
   @ DiskArrays ~/Dropbox/Caltech/work/dev/clones/forks/DiskArrays.jl/src/diskarray.jl:51
 [5] getindex_disk_nobatch!(out::Nothing, a::AccessCountDiskArray{…}, i::Tuple{…})
   @ DiskArrays ~/Dropbox/Caltech/work/dev/clones/forks/DiskArrays.jl/src/diskarray.jl:233
 [6] getindex_disk!(out::Nothing, a::AccessCountDiskArray{…}, i::Vector{…})
   @ DiskArrays ~/Dropbox/Caltech/work/dev/clones/forks/DiskArrays.jl/src/diskarray.jl:254
 [7] getindex_disk
   @ ~/Dropbox/Caltech/work/dev/clones/forks/DiskArrays.jl/src/diskarray.jl:214 [inlined]
 [8] getindex(a::AccessCountDiskArray{Int64, 3, Base.ReshapedArray{…}, DiskArrays.ChunkRead{…}}, i::Vector{Int64})
   @ DiskArrays ~/Dropbox/Caltech/work/dev/clones/forks/DiskArrays.jl/src/diskarray.jl:352
 [9] top-level scope
   @ REPL[23]:1
Some type information was truncated. Use `show(err)` to see complete types.

Can someone offer some tips? @rafaqz / @meggart ?

@rafaqz
Copy link
Collaborator

rafaqz commented Sep 24, 2024

Probably just needs to allow 0 as well as 1 on line 111 of diskarray.jl. may hit other errors after that tho

@charleskawczynski
Copy link
Contributor Author

Probably just needs to allow 0 as well as 1 on line 111 of diskarray.jl. may hit other errors after that tho

With the current set of changes, @show arraysize_from_chunksize(csnow) prints out 3 in _resolve_indices(cs, ::Tuple{}, indices_pre::DiskIndex, nb::ChunkStrategy). If I just comment this check out, the next failure is Number of indices is not correct.

@rafaqz
Copy link
Collaborator

rafaqz commented Sep 25, 2024

Ok. Probably will have to wait for @meggart to get back unless you can work through the logic

@meggart
Copy link
Collaborator

meggart commented Oct 18, 2024

Thanks a lot for starting the PR I have applied some fixes so that it works and tests pass. I am not fully happy yet, because in the case of these empty reads there is still a readblock! call executed where backends need to catch the empty input slices. I will make a fix for this as well.

@charleskawczynski
Copy link
Contributor Author

Thanks a lot for starting the PR I have applied some fixes so that it works and tests pass. I am not fully happy yet, because in the case of these empty reads there is still a readblock! call executed where backends need to catch the empty input slices. I will make a fix for this as well.

Thanks for following up with this @meggart! Please let mw know if there's any thing I can do to help

@meggart meggart merged commit 19b7044 into JuliaIO:main Oct 18, 2024
10 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.

getindex with empty index
3 participants