Skip to content

Commit 81007e1

Browse files
authored
Fix type inference issue in basket access (#243)
* Fixes a type inference issue for basket readout Closes #242 * Bump version number
1 parent db2b306 commit 81007e1

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "UnROOT"
22
uuid = "3cd96dde-e98d-4713-81e9-a4a1b0235ce9"
33
authors = ["Tamas Gal", "Jerry Ling", "Johannes Schumann", "Nick Amin"]
4-
version = "0.10.7"
4+
version = "0.10.8"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

src/iteration.jl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,23 @@ end
187187

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

195+
function _get_buffer_range(ba::LazyBranch{T, J, B}, tid::Integer, seek_idx::Integer) where {T,J,B}
196+
seek_idx -= 1
197+
ba.buffer[tid] = basketarray(ba.f, ba.b, seek_idx)
198+
(ba.fEntry[seek_idx] + 1)::Int:(ba.fEntry[seek_idx + 1])::Int
199+
end
200+
201+
function _get_buffer_range(ba::LazyBranch{T, J, B}, tid::Integer, ::Nothing) where {T,J,B}
202+
ba.buffer[tid] = basketarray(ba.f, ba.b, -1) # -1 indicating recovered basket mechanics
203+
# FIXME: this range is probably wrong for jagged data with non-empty offsets
204+
(ba.b.fBasketEntry[end] + 1)::Int:ba.b.fEntries::Int
205+
end
206+
203207
Base.IndexStyle(::Type{<:LazyBranch}) = IndexLinear()
204208

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

0 commit comments

Comments
 (0)