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

Join fails with table having key-columns only #256

Closed
MaximilianJHuber opened this issue Jun 28, 2019 · 1 comment
Closed

Join fails with table having key-columns only #256

MaximilianJHuber opened this issue Jun 28, 2019 · 1 comment

Comments

@MaximilianJHuber
Copy link

MaximilianJHuber commented Jun 28, 2019

On Julia 1.1.0, IndexedTables v0.12.0, IterableTables v0.11.0, JuliaDB v0.12.0:

using JuliaDB
t1 = table((id = [1,2], ))
t2 = table((id = [1,2,3], value = [1.2, 2.3, 3.4]))

join(t1, t2, lkey = :id, rkey = :id)

raises:

BoundsError: attempt to access StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}} with indices 1:0 at index [1]

Stacktrace:
 [1] throw_boundserror(::StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}}, ::Tuple{Int64}) at .\abstractarray.jl:484
 [2] checkbounds at .\abstractarray.jl:449 [inlined]
 [3] macro expansion at C:\Users\Max\.julia\packages\StructArrays\Du4zZ\src\structarray.jl:125 [inlined]
 [4] getindex at C:\Users\Max\.julia\packages\StructArrays\Du4zZ\src\structarray.jl:122 [inlined]
 [5] #261 at .\none:0 [inlined]
 [6] iterate at .\generator.jl:47 [inlined]
 [7] _piterate at .\iterators.jl:809 [inlined]
 [8] _piterate at .\iterators.jl:811 [inlined]
 [9] iterate at .\iterators.jl:817 [inlined]
 [10] iterate at .\generator.jl:44 [inlined]
 [11] foreach(::getfield(IndexedTables, Symbol("##265#275")){NamedTuple{(),Tuple{}},NamedTuple{(:value,),Tuple{Float64}},NamedTuple{(:id,),Tuple{Int64}},StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},NamedTuple{(:left, :right),Tuple{StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}},StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}}}}}, ::Base.Generator{Base.Iterators.ProductIterator{Tuple{Base.Generator{UnitRange{Int64},getfield(IndexedTables, Symbol("##262#272")){StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}},Array{Int64,1}}},Base.Generator{UnitRange{Int64},getfield(IndexedTables, Symbol("##261#271")){StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}},Array{Int64,1}}}}},typeof(reverse)}) at .\abstractarray.jl:1866
 [12] (::getfield(IndexedTables, Symbol("#iterate_value_push_key#270")){NamedTuple{(),Tuple{}},NamedTuple{(:value,),Tuple{Float64}},false,DataType,Nothing,Nothing,StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},NamedTuple{(:left, :right),Tuple{StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}},StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}}}},typeof(IndexedTables.concat_tup),StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}},StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}},StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},Array{Int64,1},Array{Int64,1},Bool,Bool})(::Tuple{UnitRange{Int64},UnitRange{Int64}}) at C:\Users\Max\.julia\packages\IndexedTables\DgX0A\src\join.jl:62
 [13] foreach(::getfield(IndexedTables, Symbol("#iterate_value_push_key#270")){NamedTuple{(),Tuple{}},NamedTuple{(:value,),Tuple{Float64}},false,DataType,Nothing,Nothing,StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},NamedTuple{(:left, :right),Tuple{StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}},StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}}}},typeof(IndexedTables.concat_tup),StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}},StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}},StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},Array{Int64,1},Array{Int64,1},Bool,Bool}, ::Base.Iterators.Filter{getfield(IndexedTables, Symbol("##258#267")),StructArrays.GroupJoinPerm{StructArrays.GroupPerm{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},Array{Int64,1},Base.OneTo{Int64}},StructArrays.GroupPerm{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},Array{Int64,1},Base.OneTo{Int64}}}}) at .\abstractarray.jl:1866
 [14] #_join!#256(::Type, ::Nothing, ::Nothing, ::Function, ::StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}}, ::NamedTuple{(:left, :right),Tuple{StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}},StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}}}}, ::Val{:inner}, ::Val{false}, ::typeof(IndexedTables.concat_tup), ::StructArrays.GroupJoinPerm{StructArrays.GroupPerm{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},Array{Int64,1},Base.OneTo{Int64}},StructArrays.GroupPerm{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},Array{Int64,1},Base.OneTo{Int64}}}, ::StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}}, ::StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}}) at C:\Users\Max\.julia\packages\IndexedTables\DgX0A\src\join.jl:72
 [15] (::getfield(IndexedTables, Symbol("#kw##_join!")))(::NamedTuple{(:missingtype, :init_group, :accumulate),Tuple{DataType,Nothing,Nothing}}, ::typeof(IndexedTables._join!), ::StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}}, ::NamedTuple{(:left, :right),Tuple{StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}},StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}}}}, ::Val{:inner}, ::Val{false}, ::Function, ::StructArrays.GroupJoinPerm{StructArrays.GroupPerm{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},Array{Int64,1},Base.OneTo{Int64}},StructArrays.GroupPerm{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}},Array{Int64,1},Base.OneTo{Int64}}}, ::StructArrays.StructArray{NamedTuple{(),Tuple{}},1,NamedTuple{(),Tuple{}}}, ::StructArrays.StructArray{NamedTuple{(:value,),Tuple{Float64}},1,NamedTuple{(:value,),Tuple{Array{Float64,1}}}}) at .\none:0
 [16] #join#276(::Symbol, ::Bool, ::Symbol, ::Symbol, ::Tuple{}, ::Tuple{Int64}, ::Nothing, ::Bool, ::Type, ::Nothing, ::Nothing, ::typeof(join), ::typeof(IndexedTables.concat_tup), ::IndexedTable{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}}}, ::IndexedTable{StructArrays.StructArray{NamedTuple{(:id, :value),Tuple{Int64,Float64}},1,NamedTuple{(:id, :value),Tuple{Array{Int64,1},Array{Float64,1}}}}}) at C:\Users\Max\.julia\packages\IndexedTables\DgX0A\src\join.jl:187
 [17] (::getfield(Base, Symbol("#kw##join")))(::NamedTuple{(:how, :lkey, :rkey),Tuple{Symbol,Symbol,Symbol}}, ::typeof(join), ::Function, ::IndexedTable{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}}}, ::IndexedTable{StructArrays.StructArray{NamedTuple{(:id, :value),Tuple{Int64,Float64}},1,NamedTuple{(:id, :value),Tuple{Array{Int64,1},Array{Float64,1}}}}}) at .\none:0
 [18] #join#277 at C:\Users\Max\.julia\packages\IndexedTables\DgX0A\src\join.jl:197 [inlined]
 [19] (::getfield(Base, Symbol("#kw##join")))(::NamedTuple{(:lkey, :rkey),Tuple{Symbol,Symbol}}, ::typeof(join), ::IndexedTable{StructArrays.StructArray{NamedTuple{(:id,),Tuple{Int64}},1,NamedTuple{(:id,),Tuple{Array{Int64,1}}}}}, ::IndexedTable{StructArrays.StructArray{NamedTuple{(:id, :value),Tuple{Int64,Float64}},1,NamedTuple{(:id, :value),Tuple{Array{Int64,1},Array{Float64,1}}}}}) at .\none:0
 [20] top-level scope at In[44]:3

With t1 = table((id = [1,2], t = [3.3, 4.2])) it works fine!

This is a regression from #237, not sure why...

@MaximilianJHuber
Copy link
Author

MaximilianJHuber commented Jun 28, 2019

Sorry, this was on an old version of IndexedTables!

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

No branches or pull requests

1 participant