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

feat: add content types #62

Merged
merged 53 commits into from
Feb 28, 2024
Merged

feat: add content types #62

merged 53 commits into from
Feb 28, 2024

Conversation

ianna
Copy link
Member

@ianna ianna commented Jan 30, 2024

No description provided.

@ianna ianna marked this pull request as draft January 30, 2024 22:02
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: Patch coverage is 96.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 75.29%. Comparing base (d11e61d) to head (6769ac1).
Report is 7 commits behind head on main.

Files Patch % Lines
src/all_implementations.jl 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #62      +/-   ##
==========================================
+ Coverage   74.06%   75.29%   +1.22%     
==========================================
  Files           4        4              
  Lines        1666     1623      -43     
==========================================
- Hits         1234     1222      -12     
+ Misses        432      401      -31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Moelf
Copy link
Member

Moelf commented Feb 6, 2024

sorry I should have left a comment earlier. I wonder if this is the best way to go about it. I suppose this is a way to fix things, I don't know the performance implication.

An alternative way is to fix:

abstract type Content{BEHAVIOR} <: AbstractVector{Any} end

by adding one more parametric type into it, so that it can be properly <:AbstractArray{T, 1}?

@Moelf
Copy link
Member

Moelf commented Feb 8, 2024

yeah looking into it right now, I opened #66

src/all_implementations.jl Outdated Show resolved Hide resolved
@ianna ianna marked this pull request as ready for review February 23, 2024 16:34
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding the eltype correctly—that it's the type of an element in the array (the return type of getindex)—then some of these have been set incorrectly. See below.

src/all_implementations.jl Outdated Show resolved Hide resolved
src/all_implementations.jl Outdated Show resolved Hide resolved
src/all_implementations.jl Outdated Show resolved Hide resolved
src/all_implementations.jl Outdated Show resolved Hide resolved
src/all_implementations.jl Show resolved Hide resolved
@@ -9,5 +9,9 @@ include("./tables.jl")
include("./AwkwardPythonCallExt.jl")
using .AwkwardPythonCallExt: convert

Base.eltype(::RecordArray{FIELDS,CONTENTS,BEHAVIOR}) where {FIELDS,CONTENTS,BEHAVIOR} = Record{FIELDS,CONTENTS,BEHAVIOR}
Base.eltype(::Record{FIELDS,CONTENTS,BEHAVIOR}) where {FIELDS,CONTENTS,BEHAVIOR} = CONTENTS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a Record (a scalar object, not an array) even have an eltype?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it depends on if you model the Record as an indexable thing. For me at least, I think event-based table semantically as a row table, so the eltype is whatever the type an "event" would give you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it makes sense to separate FIELDS and CONTENTS, but perhaps there is a usecase for it?

julia> typeof(layout[3])
AwkwardArray.Record{(:a, :b), Tuple{AwkwardArray.PrimitiveArray{Int64, Vector{Int64}, :default}, AwkwardArray.ListOffsetArray{Vector{Int64}, AwkwardArray.PrimitiveArray{Float64, Vector{Float64}, :default}, :default}}, :default}

julia> r = layout[3]
{a: 3, b: [4.4, 5.5]}

julia> eltype(r)
Tuple{AwkwardArray.PrimitiveArray{Int64, Vector{Int64}, :default}, AwkwardArray.ListOffsetArray{Vector{Int64}, AwkwardArray.PrimitiveArray{Float64, Vector{Float64}, :default}, :default}}

src/AwkwardArray.jl Outdated Show resolved Hide resolved
ianna and others added 10 commits February 24, 2024 07:03
Co-authored-by: Jim Pivarski <jpivarski@users.noreply.github.com>
Co-authored-by: Jim Pivarski <jpivarski@users.noreply.github.com>
Co-authored-by: Jim Pivarski <jpivarski@users.noreply.github.com>
Co-authored-by: Jim Pivarski <jpivarski@users.noreply.github.com>
@ianna ianna requested a review from jpivarski February 26, 2024 17:51
Copy link
Member Author

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added some more tests unrelated to this PR to make the coverage requirement pass.


function EmptyArray(; behavior::Symbol = :default)
new{behavior}(behavior)
end
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpivarski - I changed that to allow a copy beneath. The need for the behavior::Symbol showed in a new test.

@ianna ianna merged commit 523957f into main Feb 28, 2024
5 checks passed
@ianna ianna deleted the ianna/add_content_types branch February 28, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants