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

Hotfix for flat vector of vectors #324

Merged
merged 3 commits into from
Mar 23, 2024
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 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.
Loading