Skip to content

Commit

Permalink
Apply suggestions p3
Browse files Browse the repository at this point in the history
  • Loading branch information
eliascarv committed Apr 9, 2022
1 parent 1514725 commit 3634072
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/transforms/filter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,30 +78,30 @@ _nonmissing(x) = _nonmissing(eltype(x), x)

function apply(transform::DropMissing, table)
names = Tables.columnnames(table)
coltypes = Tables.schema(table).types
selnames = _filter(transform.colspec, names)
ftrans = _ftrans(transform, selnames)
types = Tables.schema(table).types
snames = _filter(transform.colspec, names)
ftrans = _ftrans(transform, snames)
newtable, fcache = apply(ftrans, table)

# post-processing
cols = Tables.columns(newtable)
pcols = map(names) do n
x = Tables.getcolumn(cols, n)
n selnames ? _nonmissing(x) : x
n snames ? _nonmissing(x) : x
end
𝒯 = (; zip(names, pcols)...)
ptable = 𝒯 |> Tables.materializer(newtable)

ptable, (ftrans, fcache, coltypes)
ptable, (ftrans, fcache, types)
end

function revert(::DropMissing, newtable, cache)
ftrans, fcache, coltypes = cache
ftrans, fcache, types = cache

# pre-processing
cols = Tables.columns(newtable)
names = Tables.columnnames(newtable)
pcols = map(zip(coltypes, names)) do (T, n)
pcols = map(zip(types, names)) do (T, n)
x = Tables.getcolumn(cols, n)
collect(T, x)
end
Expand Down

0 comments on commit 3634072

Please sign in to comment.