diff --git a/src/fallbacks.jl b/src/fallbacks.jl index d911ac1..dbe655d 100644 --- a/src/fallbacks.jl +++ b/src/fallbacks.jl @@ -213,7 +213,8 @@ end WT = wrappedtype(eltype(rowitr)) if WT <: Tuple return allocatecolumns(Schema((Symbol("Column$i") for i = 1:fieldcount(WT)), _fieldtypes(WT)), 0) - elseif isconcretetype(WT) && fieldcount(WT) > 0 + # special case Vector from base and view of this vector as we are sure they do not store rows of a table + elseif isconcretetype(WT) && fieldcount(WT) > 0 && !(WT <: Union{Vector, SubArray{<:Vector}}) return allocatecolumns(Schema(fieldnames(WT), _fieldtypes(WT)), 0) end end diff --git a/test/runtests.jl b/test/runtests.jl index 832dc80..480a390 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -120,6 +120,11 @@ using Test, Tables, OrderedCollections, TableTraits, DataValues, QueryOperators, sch = Tables.Schema((), ()) @test sch.names == () @test sch.types == () + + # Empty vector of Vector or their view + @test Tables.columntable(Vector{Any}[]) == NamedTuple() + T = typeof(view(Vector{Any}[], :)) + @test Tables.columntable(T[]) == NamedTuple() end @testset "namedtuples.jl" begin