-
Notifications
You must be signed in to change notification settings - Fork 2
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
Content
types need to become fully parameterized
#40
Comments
basically I want to fix this: julia> typeof(akt)
AwkwardArray.RecordArray{(:Muon_phi, :Muon_pt, :Muon_eta), Tuple{AwkwardArray.ListOffsetArray{Vector{Int64}, AwkwardArray.PrimitiveArray{Float32, Vector{Float32}, :default}, :default}, AwkwardArray.ListOffsetArray{Vector{Int64}, AwkwardArray.PrimitiveArray{Float32, Vector{Float32}, :default}, :default}, AwkwardArray.ListOffsetArray{Vector{Int64}, AwkwardArray.PrimitiveArray{Float32, Vector{Float32}, :default}, :default}}, :default}
julia> eltype(akt)
Any fixing for only Base.eltype(::RecordArray{FIELDS,CONTENTS,BEHAVIOR}) where {FIELDS,CONTENTS,BEHAVIOR} = Record{FIELDS,CONTENTS,BEHAVIOR}
julia> eltype(akt) == typeof(akt[1])
true but in case you actually wanted to have this in |
ultimately, |
Moelf
changed the title
Oct 15, 2023
abstract type Content
is type unstable under eltype(x::Content)
abstract type Content
returns Any under eltype(x::Content)
jpivarski
changed the title
Jan 24, 2024
abstract type Content
returns Any under eltype(x::Content)
Content
types need to become fully parameterized
this is now fixed: julia> o = AwkwardArray.ListOffsetArray([0,2,2,3], AwkwardArray.PrimitiveArray([1,2,3,4]))
3-element AwkwardArray.ListOffsetArray{Vector{Int64}, AwkwardArray.PrimitiveArray{Int64, Vector{Int64}, :default}, :default}:
[1, 2]
0-element AwkwardArray.PrimitiveArray{Int64, Vector{Int64}, :default}
[3]
julia> a = AwkwardArray.RecordArray((;x=AwkwardArray.PrimitiveArray([1,2,3]), o))
3-element AwkwardArray.RecordArray{(:x, :o), Tuple{AwkwardArray.PrimitiveArray{Int64, Vector{Int64}, :default}, AwkwardArray.ListOffsetArray{Vector{Int64}, AwkwardArray.PrimitiveArray{Int64, Vector{Int64}, :default}, :default}}, :default}:
{x: 1, o: [1, 2]}
{x: 2, o: []}
{x: 3, o: [3]}
julia> eltype(a)
AwkwardArray.Record{(:x, :o), Tuple{AwkwardArray.PrimitiveArray{Int64, Vector{Int64}, :default}, AwkwardArray.ListOffsetArray{Vector{Int64}, AwkwardArray.PrimitiveArray{Int64, Vector{Int64}, :default}, :default}}, :default} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Previous title:
abstract type Content
returns Any undereltype(x::Content)
I'm trying to make RecordArrays
to/from_table
round-tripable, and come across:https://github.com/jpivarski/AwkwardArray.jl/blob/b53fed9b9fe99d1dc459c37bba9f70e4cd950abd/src/AwkwardArray.jl#L105
the
ITEM where ITEM
doesn't do anything because:so effectively the "element type" of a
Content{BEHAVIOR}
is not encoded in the type parameters -- this may be fine. But I just want to make sure this is intended before I go about and defineeltype()
for each of the subtypes ofContent
The text was updated successfully, but these errors were encountered: