@@ -17,6 +17,14 @@ trait can be evaluated directly at any table implementing the
1717"""
1818abstract type Transform end
1919
20+ """
21+ transform(table)
22+
23+ Automatically generated functor interface that calls [`apply`](@ref)
24+ with `transform` and `table`. New types don't need to implement this.
25+ """
26+ (transform:: Transform )(table) = apply (transform, table) |> first
27+
2028"""
2129 isrevertible(transform)
2230
@@ -39,7 +47,7 @@ function apply end
3947
4048Revert the `transform` on the `newtable` using the `cache` from the
4149corresponding [`apply`](@ref) call and return the original `table`.
42- Only defined when the transform [`isrevertible`](@ref).
50+ Only defined when the ` transform` [`isrevertible`](@ref).
4351"""
4452function revert end
4553
@@ -62,12 +70,38 @@ that was created with a previous [`apply`](@ref) call.
6270reapply (transform:: Stateless , table, cache) = apply (transform, table)
6371
6472"""
65- transform(table)
73+ Colwise
6674
67- Automatically generated functor interface that calls [`apply`](@ref)
68- with `transform` and `table`.
75+ A transform that is applied column-by-column. In this case, the new type
76+ only needs to implement [`colapply`](@ref), [`colrevert`](@ref) and
77+ [`colcache`](@ref). Efficient fallbacks are provided that execute these
78+ functions in parallel for all columns with multiple threads.
6979"""
70- (transform:: Transform )(table) = apply (transform, table) |> first
80+ abstract type Colwise <: Transform end
81+
82+ """
83+ y = colapply(transform, x, c)
84+
85+ Apply `transform` to column `x` with cache `c` and return new column `y`.
86+ """
87+ function colapply end
88+
89+ """
90+ x = colrevert(transform, y, c)
91+
92+ Revert `transform` starting from column `y` with cache `c` and return
93+ original column `x`. Only defined when the `transform` [`isrevertible`](@ref).
94+ """
95+ function colrevert end
96+
97+ """
98+ c = colcache(transform, x)
99+
100+ Produce cache `c` necessary to [`colapply`](@ref) the `transform` on `x`.
101+ If the `transform` [`isrevertible`](@ref) then the cache `c` can also be
102+ used in [`colrevert`](@ref).
103+ """
104+ function colcache end
71105
72106# ----------------
73107# IMPLEMENTATIONS
0 commit comments