Skip to content

Commit

Permalink
Fix type inference issue in basket access (#243)
Browse files Browse the repository at this point in the history
* Fixes a type inference issue for basket readout

Closes #242

* Bump version number
  • Loading branch information
tamasgal authored Apr 24, 2023
1 parent db2b306 commit 81007e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
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

2 comments on commit 81007e1

@tamasgal
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/82219

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.8 -m "<description of version>" 81007e16fe0253e4d9e6652f1cf41ae853c9061b
git push origin v0.10.8

Please sign in to comment.