11// SPDX-License-Identifier: Apache-2.0
22// SPDX-FileCopyrightText: Copyright the Vortex contributors
33
4+ use prost:: Message ;
45use std:: fmt:: Formatter ;
56use vortex_array:: compute:: { between as between_compute, BetweenOptions } ;
67use vortex_array:: ArrayRef ;
78use vortex_dtype:: DType ;
89use vortex_dtype:: DType :: Bool ;
910use vortex_error:: { vortex_bail, VortexExpect , VortexResult } ;
11+ use vortex_proto:: expr as pb;
1012
1113use crate :: exprs:: binary:: Binary ;
1214use crate :: exprs:: operators:: Operator ;
@@ -33,6 +35,32 @@ impl VTable for Between {
3335 ExprId :: from ( "vortex.between" )
3436 }
3537
38+ fn serialize ( & self , instance : & Self :: Instance ) -> VortexResult < Option < Vec < u8 > > > {
39+ Ok ( Some (
40+ pb:: BetweenOpts {
41+ lower_strict : instance. lower_strict . is_strict ( ) ,
42+ upper_strict : instance. upper_strict . is_strict ( ) ,
43+ }
44+ . encode_to_vec ( ) ,
45+ ) )
46+ }
47+
48+ fn deserialize ( & self , metadata : & [ u8 ] ) -> VortexResult < Option < Self :: Instance > > {
49+ let opts = pb:: BetweenOpts :: decode ( metadata) ?;
50+ Ok ( Some ( BetweenOptions {
51+ lower_strict : if opts. lower_strict {
52+ vortex_array:: compute:: StrictComparison :: Strict
53+ } else {
54+ vortex_array:: compute:: StrictComparison :: NonStrict
55+ } ,
56+ upper_strict : if opts. upper_strict {
57+ vortex_array:: compute:: StrictComparison :: Strict
58+ } else {
59+ vortex_array:: compute:: StrictComparison :: NonStrict
60+ } ,
61+ } ) )
62+ }
63+
3664 fn validate ( & self , expr : & ExprInstance < Self > ) -> VortexResult < ( ) > {
3765 if expr. children ( ) . len ( ) != 3 {
3866 vortex_bail ! (
0 commit comments