Skip to content

Commit

Permalink
Hotfix for flat vector of vectors (#324)
Browse files Browse the repository at this point in the history
* Hotfix for flat vector of vectors

* Add test

* Fix typo
  • Loading branch information
tamasgal authored Mar 23, 2024
1 parent 08eb84c commit c30ba48
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/iteration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ mutable struct LazyBranch{T,J,B} <: AbstractVector{T}
if J != Nojagg
# if branch is jagged, fix the buffer and eltype according to what
# VectorOfVectors would return in `getindex`
_buffer = VectorOfVectors(T(), Int32[1])
_buffer = isbitstype(T) ? VectorOfVectors(T[], Int32[1]) : VectorOfVectors(T(), Int32[1])
T = SubArray{eltype(T), 1, T, Tuple{UnitRange{Int64}}, true}
end
Nthreads = _maxthreadid()
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,13 @@ end
# issue 246
arr = LazyTree(joinpath(SAMPLES_DIR, "issue246.root"), "tree_NOMINAL").v_mcGenWgt
@test all(reduce(vcat, arr) .== 1.0)

# issue 323
f = ROOTFile(joinpath(SAMPLES_DIR, "issue323.root"))
t = LazyTree(f, "sim", [r"ghost/ghost\.(.*)" => s"\1"])
@test 1200 == length(t)
@test t[1].time[2] 36.396744f0
@test t[end].xpos[end] 788.35144f0
end

@testset "jagged subbranch type by leaf" begin
Expand Down
Binary file added test/samples/issue323.root
Binary file not shown.

0 comments on commit c30ba48

Please sign in to comment.