Skip to content

Commit 27faaa7

Browse files
committed
Support ArraysOfArrays v1
ArraysOfArrays v1 adds the element type of VectorOfVectors as a fifth type parameter, so the four-parameter type spelled out in _field_output_type is no longer concrete there and the type assertions for struct fields containing vectors fail. The vector field output type now goes through a version-conditional helper. Created by generative AI.
1 parent 9d509cf commit 27faaa7

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ UnROOTXRootDExt = "XRootD"
3838
AbstractTrees = "^0.4"
3939
Accessors = "0.1.36"
4040
Aqua = "^0.8"
41-
ArraysOfArrays = "^0.6"
41+
ArraysOfArrays = "^0.6, ^1"
4242
Arrow = "~2.7.1"
4343
BitIntegers = "^0.3"
4444
CodecLz4 = "^0.4"

src/RNTuple/fieldcolumn_reading.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@ function read_field(io, field::LeafField{Bool}, page_list)
147147
return res::_field_output_type(field)
148148
end
149149

150-
_field_output_type(::Type{VectorField{O, T}}) where {O, T} = VectorOfVectors{eltype(_field_output_type(T)), _field_output_type(T), Vector{eltype(O)}, Vector{Tuple{}}}
150+
# ArraysOfArrays v1 adds the element type of VectorOfVectors as a fifth type parameter
151+
@static if pkgversion(ArraysOfArrays) >= v"1"
152+
_vov_type(::Type{VT}, ::Type{VI}) where {VT, VI} = VectorOfVectors{eltype(VT), VT, VI, Vector{Tuple{}}, Base.promote_op(view, VT, UnitRange{Int})}
153+
else
154+
_vov_type(::Type{VT}, ::Type{VI}) where {VT, VI} = VectorOfVectors{eltype(VT), VT, VI, Vector{Tuple{}}}
155+
end
156+
_field_output_type(::Type{VectorField{O, T}}) where {O, T} = _vov_type(_field_output_type(T), Vector{eltype(O)})
151157
function read_field(io, field::VectorField{O, T}, page_list) where {O, T}
152158
offset = read_field(io, field.offset_col, page_list)
153159
content = read_field(io, field.content_col, page_list)

0 commit comments

Comments
 (0)