@@ -17,9 +17,8 @@ use vortex_array::arrays::varbinview::VarBinViewArrayExt;
1717use vortex_array:: dtype:: DType ;
1818use vortex_array:: dtype:: Nullability ;
1919use vortex_array:: dtype:: PType ;
20- use vortex_array:: expr:: Expression ;
21- use vortex_array:: expr:: is_root;
22- use vortex_array:: expr:: not;
20+ use vortex_array:: expr:: BoundExpression ;
21+ use vortex_array:: expr:: bound:: not;
2322use vortex_array:: scalar:: Scalar ;
2423use vortex_array:: scalar_fn:: Arity ;
2524use vortex_array:: scalar_fn:: ChildName ;
@@ -31,10 +30,10 @@ use vortex_array::scalar_fn::fns::binary::Binary;
3130use vortex_array:: scalar_fn:: fns:: literal:: Literal ;
3231use vortex_array:: scalar_fn:: fns:: operators:: Operator ;
3332use vortex_array:: scalar_fn:: session:: ScalarFnSessionExt ;
33+ use vortex_array:: stats:: expr:: bound_stat;
3434use vortex_array:: stats:: rewrite:: StatsRewriteCtx ;
3535use vortex_array:: stats:: rewrite:: StatsRewriteRule ;
3636use vortex_array:: stats:: session:: StatsSessionExt ;
37- use vortex_array:: stats:: stat;
3837use vortex_buffer:: BitBuffer ;
3938use vortex_error:: VortexResult ;
4039use vortex_error:: vortex_ensure;
@@ -167,10 +166,6 @@ impl ScalarFnVTable for BloomContains {
167166 Ok ( BoolArray :: new ( BitBuffer :: from_iter ( possible) , validity) . into_array ( ) )
168167 }
169168
170- fn is_null_sensitive ( & self , _options : & Self :: Options ) -> bool {
171- false
172- }
173-
174169 fn is_fallible ( & self , _options : & Self :: Options ) -> bool {
175170 false
176171 }
@@ -189,16 +184,16 @@ impl StatsRewriteRule for BloomEqRewrite {
189184
190185 fn falsify (
191186 & self ,
192- expr : & Expression ,
187+ expr : & BoundExpression ,
193188 ctx : & StatsRewriteCtx < ' _ > ,
194- ) -> VortexResult < Option < Expression > > {
189+ ) -> VortexResult < Option < BoundExpression > > {
195190 if * expr. as_ :: < Binary > ( ) != Operator :: Eq {
196191 return Ok ( None ) ;
197192 }
198193
199- let ( column, literal) = if is_root ( expr. child ( 0 ) ) && expr. child ( 1 ) . is :: < Literal > ( ) {
194+ let ( column, literal) = if expr. child ( 0 ) . is_root ( ) && expr. child ( 1 ) . is :: < Literal > ( ) {
200195 ( expr. child ( 0 ) , expr. child ( 1 ) )
201- } else if is_root ( expr. child ( 1 ) ) && expr. child ( 0 ) . is :: < Literal > ( ) {
196+ } else if expr. child ( 1 ) . is_root ( ) && expr. child ( 0 ) . is :: < Literal > ( ) {
202197 ( expr. child ( 1 ) , expr. child ( 0 ) )
203198 } else {
204199 return Ok ( None ) ;
@@ -209,8 +204,9 @@ impl StatsRewriteRule for BloomEqRewrite {
209204 return Ok ( None ) ;
210205 }
211206
212- let filter = stat ( column. clone ( ) , BloomFilter . bind ( self . options . clone ( ) ) ) ;
213- let contains = BloomContains . new_expr ( self . options . clone ( ) , [ filter, literal. clone ( ) ] ) ;
207+ let filter = bound_stat ( column. clone ( ) , BloomFilter . bind ( self . options . clone ( ) ) ) ;
208+ let contains =
209+ BloomContains . try_new_bound_expr ( self . options . clone ( ) , [ filter, literal. clone ( ) ] ) ?;
214210 Ok ( Some ( not ( contains) ) )
215211 }
216212}
@@ -225,9 +221,9 @@ mod tests {
225221 use vortex_array:: dtype:: DType ;
226222 use vortex_array:: dtype:: Nullability ;
227223 use vortex_array:: dtype:: PType ;
228- use vortex_array:: expr:: eq;
229- use vortex_array:: expr:: lit;
230- use vortex_array:: expr:: root;
224+ use vortex_array:: expr:: bound :: eq;
225+ use vortex_array:: expr:: bound :: lit;
226+ use vortex_array:: expr:: bound :: root;
231227 use vortex_array:: validity:: Validity ;
232228 use vortex_error:: VortexResult ;
233229
@@ -248,16 +244,14 @@ mod tests {
248244 let session = vortex_array:: array_session ( ) ;
249245 let index = BloomSkipIndex :: new ( small_options ( ) ) ;
250246 index. register ( & session) ;
251- let predicate = eq ( root ( ) , lit ( 42i64 ) ) ;
247+ let dtype = DType :: Primitive ( PType :: I64 , Nullability :: NonNullable ) ;
248+ let predicate = eq ( root ( dtype. clone ( ) ) , lit ( 42i64 ) ) ;
252249 let proof = predicate
253- . falsify (
254- & DType :: Primitive ( PType :: I64 , Nullability :: NonNullable ) ,
255- & session,
256- ) ?
250+ . falsify ( & session) ?
257251 . expect ( "equality has a bloom proof" ) ;
258252
259253 let zone_map = ZoneMap :: try_new (
260- DType :: Primitive ( PType :: I64 , Nullability :: NonNullable ) ,
254+ dtype ,
261255 StructArray :: try_new ( Vec :: < & str > :: new ( ) . into ( ) , vec ! [ ] , 2 , Validity :: NonNullable ) ?,
262256 Arc :: new ( [ ] ) ,
263257 8 ,
0 commit comments