@@ -19,7 +19,6 @@ use crate::aggregate_fn::AggregateFnRef;
1919use crate :: dtype:: DType ;
2020use crate :: expr:: Expression ;
2121use crate :: expr:: lit;
22- use crate :: expr:: stats:: Stat ;
2322use crate :: expr:: traversal:: NodeExt ;
2423use crate :: expr:: traversal:: Transformed ;
2524use crate :: scalar:: Scalar ;
@@ -43,24 +42,10 @@ pub trait StatBinder {
4342 self . scope ( ) . clone ( )
4443 }
4544
46- /// Bind `stat(input)` to a concrete expression.
47- ///
48- /// Returning `Ok(None)` marks the stat as unavailable. [`bind_stats`] will
49- /// then call [`Self::missing_stat`] with the dtype expected from the
50- /// original `vortex.stat` expression.
51- fn bind_stat (
52- & self ,
53- input : & Expression ,
54- stat : Stat ,
55- stat_dtype : & DType ,
56- ) -> VortexResult < Option < Expression > > ;
57-
5845 /// Bind `aggregate_fn(input)` to a concrete expression.
5946 ///
6047 /// Implementations should return `Ok(None)` when the requested aggregate
61- /// statistic is unavailable in their backing representation. Binders that
62- /// support only direct legacy [`Stat`] slots can delegate to
63- /// [`bind_direct_aggregate_stat`].
48+ /// statistic is unavailable in their backing representation.
6449 fn bind_aggregate (
6550 & self ,
6651 input : & Expression ,
@@ -106,19 +91,6 @@ pub fn bind_stats<B: StatBinder + ?Sized>(
10691 lowered. optimize_recursive ( & binder. bound_scope ( ) )
10792}
10893
109- /// Bind an aggregate function that has a direct legacy [`Stat`] slot.
110- pub fn bind_direct_aggregate_stat < B : StatBinder + ?Sized > (
111- binder : & B ,
112- input : & Expression ,
113- aggregate_fn : & AggregateFnRef ,
114- stat_dtype : & DType ,
115- ) -> VortexResult < Option < Expression > > {
116- let Some ( stat) = Stat :: from_aggregate_fn ( aggregate_fn) else {
117- return Ok ( None ) ;
118- } ;
119- binder. bind_stat ( input, stat, stat_dtype)
120- }
121-
12294fn bind_stat_fn (
12395 expr : & Expression ,
12496 scope : & DType ,
@@ -151,6 +123,7 @@ mod tests {
151123 use crate :: expr:: is_null;
152124 use crate :: expr:: or;
153125 use crate :: expr:: root;
126+ use crate :: expr:: stats:: Stat ;
154127 use crate :: stats:: all_non_nan;
155128 use crate :: stats:: nan_count;
156129
@@ -191,27 +164,22 @@ mod tests {
191164 self . bound_scope . clone ( )
192165 }
193166
194- fn bind_stat (
167+ fn bind_aggregate (
195168 & self ,
196169 _input : & Expression ,
197- stat : Stat ,
170+ aggregate_fn : & AggregateFnRef ,
198171 _stat_dtype : & DType ,
199172 ) -> VortexResult < Option < Expression > > {
173+ let Some ( stat) = Stat :: from_aggregate_fn ( aggregate_fn) else {
174+ return Ok ( None ) ;
175+ } ;
176+
200177 if stat == Stat :: NaNCount && self . bind_nan_count {
201178 Ok ( Some ( get_item ( "f_nan_count" , root ( ) ) ) )
202179 } else {
203180 Ok ( None )
204181 }
205182 }
206-
207- fn bind_aggregate (
208- & self ,
209- input : & Expression ,
210- aggregate_fn : & AggregateFnRef ,
211- stat_dtype : & DType ,
212- ) -> VortexResult < Option < Expression > > {
213- bind_direct_aggregate_stat ( self , input, aggregate_fn, stat_dtype)
214- }
215183 }
216184
217185 #[ test]
0 commit comments