diff --git a/src/abstractdataframe/abstractdataframe.jl b/src/abstractdataframe/abstractdataframe.jl index e8f4e32ed..65635a76b 100644 --- a/src/abstractdataframe/abstractdataframe.jl +++ b/src/abstractdataframe/abstractdataframe.jl @@ -1956,6 +1956,10 @@ Base.reduce(::typeof(vcat), init::AbstractDataFrame=DataFrame()) = reduce(vcat, collect(AbstractDataFrame, dfs), cols=cols, source=source, init=init) +# definition fixing type piracy +Base.reduce(op::typeof(vcat), A::AbstractVector{Union{}}; kw...) = + mapreduce(identity, op, A; kw...) + function _vcat(dfs::AbstractVector{AbstractDataFrame}; cols::Union{Symbol, AbstractVector{Symbol}, AbstractVector{<:AbstractString}}=:setequal) diff --git a/test/cat.jl b/test/cat.jl index b5aa1cfd9..5f45230e9 100644 --- a/test/cat.jl +++ b/test/cat.jl @@ -477,4 +477,9 @@ end @test reduce(vcat, (df1, df2)) == DataFrame(a=[1, 1], b=[2, 2]) end +@testset "vcat type piracy" begin + x = Int[] + @test reduce(vcat, Union{}[], init=x) === x +end + end # module