Skip to content

Commit

Permalink
faster vcat (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf authored Feb 23, 2022
1 parent 36fa5eb commit aca778f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/iteration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,11 @@ Base.ndims(::Type{<:LazyTree}) = 1
Base.size(lt::LazyTree) = size(innertable(lt))

function LazyArrays.Vcat(ts::LazyTree...)
cs = Tables.columns.(innertable.(ts))
LazyTree(TypedTables.Table(map(Vcat, cs...)))
branch_names = propertynames(first(ts))
res_branches = map(branch_names) do bname
LazyArrays.Vcat(getproperty.(ts, bname)...)
end
LazyTree(TypedTables.Table(NamedTuple{branch_names}(res_branches)))
end
Base.vcat(ts::LazyTree...) = Vcat(ts...)
Base.reduce(::typeof(vcat), ts::AbstractVector{<:LazyTree}) = Vcat((ts)...)
Expand Down

0 comments on commit aca778f

Please sign in to comment.