@@ -88,7 +88,7 @@ impl TernarySet {
8888 /// U | U
8989 /// T | F
9090 /// ```
91- fn not ( set : Self ) -> Self {
91+ fn not ( set : & Self ) -> Self {
9292 let mut not = Self :: empty ( ) ;
9393 if set. contains ( Self :: TRUE ) {
9494 not. toggle ( Self :: FALSE ) ;
@@ -114,7 +114,7 @@ impl TernarySet {
114114 /// U │ F U U
115115 /// T │ F U T
116116 /// ```
117- fn and ( lhs : Self , rhs : Self ) -> Self {
117+ fn and ( lhs : & Self , rhs : & Self ) -> Self {
118118 if lhs. is_empty ( ) || rhs. is_empty ( ) {
119119 return Self :: empty ( ) ;
120120 }
@@ -149,7 +149,7 @@ impl TernarySet {
149149 /// U │ U U T
150150 /// T │ T T T
151151 /// ```
152- fn or ( lhs : Self , rhs : Self ) -> Self {
152+ fn or ( lhs : & Self , rhs : & Self ) -> Self {
153153 let mut or = Self :: empty ( ) ;
154154 if lhs. contains ( Self :: TRUE ) || rhs. contains ( Self :: TRUE ) {
155155 or. toggle ( Self :: TRUE ) ;
@@ -327,36 +327,38 @@ impl PredicateBoundsEvaluator<'_> {
327327 match e. get_type ( self . input_schema ) ? {
328328 // If `e` is a boolean expression, try to evaluate it and test for not unknown
329329 DataType :: Boolean => {
330- TernarySet :: not ( self . evaluate_bounds ( e) ?. is_unknown ( ) )
330+ TernarySet :: not ( & self . evaluate_bounds ( e) ?. is_unknown ( ) )
331331 }
332332 // If `e` is not a boolean expression, check if `e` is provably null
333- _ => TernarySet :: not ( self . is_null ( e) ) ,
333+ _ => TernarySet :: not ( & self . is_null ( e) ) ,
334334 }
335335 }
336336 }
337337 Expr :: IsTrue ( e) => self . evaluate_bounds ( e) ?. is_true ( ) ,
338- Expr :: IsNotTrue ( e) => TernarySet :: not ( self . evaluate_bounds ( e) ?. is_true ( ) ) ,
338+ Expr :: IsNotTrue ( e) => TernarySet :: not ( & self . evaluate_bounds ( e) ?. is_true ( ) ) ,
339339 Expr :: IsFalse ( e) => self . evaluate_bounds ( e) ?. is_false ( ) ,
340- Expr :: IsNotFalse ( e) => TernarySet :: not ( self . evaluate_bounds ( e) ?. is_false ( ) ) ,
340+ Expr :: IsNotFalse ( e) => TernarySet :: not ( & self . evaluate_bounds ( e) ?. is_false ( ) ) ,
341341 Expr :: IsUnknown ( e) => self . evaluate_bounds ( e) ?. is_unknown ( ) ,
342342 Expr :: IsNotUnknown ( e) => {
343- TernarySet :: not ( self . evaluate_bounds ( e) ?. is_unknown ( ) )
343+ TernarySet :: not ( & self . evaluate_bounds ( e) ?. is_unknown ( ) )
344344 }
345- Expr :: Not ( e) => TernarySet :: not ( self . evaluate_bounds ( e) ?) ,
345+ Expr :: Not ( e) => TernarySet :: not ( & self . evaluate_bounds ( e) ?) ,
346346 Expr :: BinaryExpr ( BinaryExpr {
347347 left,
348348 op : Operator :: And ,
349349 right,
350- } ) => {
351- TernarySet :: and ( self . evaluate_bounds ( left) ?, self . evaluate_bounds ( right) ?)
352- }
350+ } ) => TernarySet :: and (
351+ & self . evaluate_bounds ( left) ?,
352+ & self . evaluate_bounds ( right) ?,
353+ ) ,
353354 Expr :: BinaryExpr ( BinaryExpr {
354355 left,
355356 op : Operator :: Or ,
356357 right,
357- } ) => {
358- TernarySet :: or ( self . evaluate_bounds ( left) ?, self . evaluate_bounds ( right) ?)
359- }
358+ } ) => TernarySet :: or (
359+ & self . evaluate_bounds ( left) ?,
360+ & self . evaluate_bounds ( right) ?,
361+ ) ,
360362 e => {
361363 let mut result = TernarySet :: empty ( ) ;
362364 let is_null = self . is_null ( e) ;
@@ -505,7 +507,7 @@ mod tests {
505507 ] ;
506508
507509 for case in cases {
508- assert_eq ! ( TernarySet :: not( case. 0 ) , case. 1 ) ;
510+ assert_eq ! ( TernarySet :: not( & case. 0 ) , case. 1 ) ;
509511 }
510512 }
511513
@@ -571,20 +573,20 @@ mod tests {
571573
572574 for case in cases {
573575 assert_eq ! (
574- TernarySet :: and( case. 0 . clone ( ) , case. 1 . clone ( ) ) ,
576+ TernarySet :: and( & case. 0 , & case. 1 ) ,
575577 case. 2 . clone( ) ,
576578 "{:?} & {:?} = {:?}" ,
577579 case. 0 . clone( ) ,
578580 case. 1 . clone( ) ,
579581 case. 2 . clone( )
580582 ) ;
581583 assert_eq ! (
582- TernarySet :: and( case. 1 . clone ( ) , case. 0 . clone ( ) ) ,
584+ TernarySet :: and( & case. 1 , & case. 0 ) ,
583585 case. 2 . clone( ) ,
584586 "{:?} & {:?} = {:?}" ,
585- case. 1 . clone ( ) ,
586- case. 0 . clone ( ) ,
587- case. 2 . clone ( )
587+ case. 1 ,
588+ case. 0 ,
589+ case. 2
588590 ) ;
589591 }
590592 }
@@ -641,20 +643,20 @@ mod tests {
641643
642644 for case in cases {
643645 assert_eq ! (
644- TernarySet :: or( case. 0 . clone ( ) , case. 1 . clone ( ) ) ,
646+ TernarySet :: or( & case. 0 , & case. 1 ) ,
645647 case. 2 . clone( ) ,
646648 "{:?} | {:?} = {:?}" ,
647- case. 0 . clone ( ) ,
648- case. 1 . clone ( ) ,
649- case. 2 . clone ( )
649+ case. 0 ,
650+ case. 1 ,
651+ case. 2
650652 ) ;
651653 assert_eq ! (
652- TernarySet :: or( case. 1 . clone ( ) , case. 0 . clone ( ) ) ,
654+ TernarySet :: or( & case. 1 , & case. 0 ) ,
653655 case. 2 . clone( ) ,
654656 "{:?} | {:?} = {:?}" ,
655- case. 1 . clone ( ) ,
656- case. 0 . clone ( ) ,
657- case. 2 . clone ( )
657+ case. 1 ,
658+ case. 0 ,
659+ case. 2
658660 ) ;
659661 }
660662 }
0 commit comments