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

Explicit error for unequal column sizes #88

Open
adigitoleo opened this issue Jan 5, 2022 · 1 comment
Open

Explicit error for unequal column sizes #88

adigitoleo opened this issue Jan 5, 2022 · 1 comment

Comments

@adigitoleo
Copy link

Low priority, QOL issue. The constructors could throw an error if the column sizes don't match. Currently they are quietly accepted until the table is shown/acessed, and then:

julia> t = Table(a = [1, 2, 3], b = [2.0, 4.0])
Table with 2 columns and 3 rowsError showing value of type Table{NamedTuple{(:a, :b), Tuple{Int64, Float64}}, 1, NamedTuple{(:a, :b), Tuple{Vector{Int64}, Vector{Float64}}}}:
ERROR: BoundsError: attempt to access 3-element Table{NamedTuple{(:a, :b), Tuple{Int64, Float64}}, 1, NamedTuple{(:a, :b), Tuple{Vector{Int64}, Vector{Float64}}}} at index [3]
Stacktrace:
  [1] throw_boundserror(A::Table{NamedTuple{(:a, :b), Tuple{Int64, Float64}}, 1, NamedTuple{(:a, :b), Tuple{Vector{Int64}, Vector{Float64}}}}, I::Tuple{Int64})
    @ Base ./abstractarray.jl:691
  [2] checkbounds
    @ ./abstractarray.jl:656 [inlined]
  [3] getindex(t::Table{NamedTuple{(:a, :b), Tuple{Int64, Float64}}, 1, NamedTuple{(:a, :b), Tuple{Vector{Int64}, Vector{Float64}}}}, i::Int64)
    @ TypedTables ~/vcs/TypedTables.jl/src/Table.jl:128
  [4] showtable(io::IOContext{Base.TTY}, t::Any, keyname::Nothing)
    @ TypedTables ~/vcs/TypedTables.jl/src/show.jl:141
  [5] showtable
    @ ~/vcs/TypedTables.jl/src/show.jl:102 [inlined]
[...]
@andyferris
Copy link
Member

Yes, I think we should look at this. The dictionary-based tables have some checks now I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants