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

Fix type inference issue in basket access #243

Merged
merged 2 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "UnROOT"
uuid = "3cd96dde-e98d-4713-81e9-a4a1b0235ce9"
authors = ["Tamas Gal", "Jerry Ling", "Johannes Schumann", "Nick Amin"]
version = "0.10.7"
version = "0.10.8"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
22 changes: 13 additions & 9 deletions src/iteration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,23 @@ end

function _localindex_newbasket!(ba::LazyBranch{T,J,B}, idx::Integer, tid::Int) where {T,J,B}
seek_idx = findfirst(x -> x > (idx - 1), ba.fEntry) #support 1.0 syntax
if isnothing(seek_idx) # no basket found, checking in recovered basket
ba.buffer[tid] = basketarray(ba.f, ba.b, -1) # -1 indicating recovered basket mechanics
# FIXME: this range is probably wrong for jagged data with non-empty offsets
br = ba.b.fBasketEntry[end] + 1:ba.b.fEntries
else
seek_idx -= 1
ba.buffer[tid] = basketarray(ba.f, ba.b, seek_idx)
br = (ba.fEntry[seek_idx] + 1):(ba.fEntry[seek_idx + 1])
end
br = _get_buffer_range(ba, tid, seek_idx)
ba.buffer_range[tid] = br
return idx - br.start + 1
end

function _get_buffer_range(ba::LazyBranch{T, J, B}, tid::Integer, seek_idx::Integer) where {T,J,B}
seek_idx -= 1
ba.buffer[tid] = basketarray(ba.f, ba.b, seek_idx)
(ba.fEntry[seek_idx] + 1)::Int:(ba.fEntry[seek_idx + 1])::Int
end

function _get_buffer_range(ba::LazyBranch{T, J, B}, tid::Integer, ::Nothing) where {T,J,B}
ba.buffer[tid] = basketarray(ba.f, ba.b, -1) # -1 indicating recovered basket mechanics
# FIXME: this range is probably wrong for jagged data with non-empty offsets
(ba.b.fBasketEntry[end] + 1)::Int:ba.b.fEntries::Int
end

Base.IndexStyle(::Type{<:LazyBranch}) = IndexLinear()

function Base.iterate(ba::LazyBranch{T,J,B}, idx=1) where {T,J,B}
Expand Down