JuliaArrays / JuliaArrays/StructArrays.jl
push! does not check for column length consistency
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 402
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
Are these two scenarios intended?
julia> t = StructArray([(a=1,b=2)])
1-element StructArray(::Array{Int64,1}, ::Array{Int64,1}) with eltype NamedTuple{(:a, :b),Tuple{Int64,Int64}}:
(a = 1, b = 2)
julia> push!(t,(a=2,b="3"))
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Int64
julia> t
2-element StructArray(::Array{Int64,1}, ::Array{Int64,1}) with eltype NamedTuple{(:a, :b),Tuple{Int64,Int64}}:
(a = 1, b = 2)
(a = 2, b = 140572479985616)
julia> t = StructArray([(a=1,b="2")])
1-element StructArray(::Array{Int64,1}, ::Array{String,1}) with eltype NamedTuple{(:a, :b),Tuple{Int64,String}}:
(a = 1, b = "2")
julia> push!(t,(a=2,b=3))
ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type String
julia> t
2-element StructArray(::Array{Int64,1}, ::Array{String,1}) with eltype NamedTuple{(:a, :b),Tuple{Int64,String}}:
Error showing value of type StructArray{NamedTuple{(:a, :b),Tuple{Int64,String}},1,NamedTuple{(:a, :b),Tuple{Array{Int64,1},Array{String,1}}},Int64}:
(I could not find this case noted in other places - it seems for me to be a bug, but maybe it is intended for performance reasons?)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing both push! examples with StructArray values having incompatible column types. Inspect the push! entry point and related tests, then verify that a failed insertion does not change the array or leave it in an invalid state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100