@@ -7,15 +7,18 @@ use std::fmt::Display;
77use std:: fmt:: Formatter ;
88use std:: hash:: Hash ;
99use std:: hash:: Hasher ;
10+ use std:: ops:: Deref ;
1011
1112use vortex_dtype:: DType ;
1213use vortex_error:: VortexResult ;
1314use vortex_utils:: debug_with:: DebugWith ;
1415use vortex_vector:: Datum ;
1516
17+ use crate :: ArrayRef ;
1618use crate :: expr:: ExecutionArgs ;
1719use crate :: expr:: ExprId ;
1820use crate :: expr:: ExprVTable ;
21+ use crate :: expr:: Expression ;
1922use crate :: expr:: VTable ;
2023use crate :: expr:: options:: ExpressionOptions ;
2124use crate :: expr:: signature:: ExpressionSignature ;
@@ -67,36 +70,44 @@ impl BoundExpression {
6770 pub fn options ( & self ) -> ExpressionOptions < ' _ > {
6871 ExpressionOptions {
6972 vtable : & self . vtable ,
70- options : self . options . as_ref ( ) ,
73+ options : self . options . deref ( ) ,
7174 }
7275 }
7376
7477 /// Signature information for this expression.
7578 pub fn signature ( & self ) -> ExpressionSignature < ' _ > {
7679 ExpressionSignature {
7780 vtable : & self . vtable ,
78- options : self . options . as_ref ( ) ,
81+ options : self . options . deref ( ) ,
7982 }
8083 }
8184
8285 /// Compute the return [`DType`] of this expression given the input argument types.
8386 pub fn return_dtype ( & self , arg_types : & [ DType ] ) -> VortexResult < DType > {
8487 self . vtable
8588 . as_dyn ( )
86- . return_dtype ( self . options . as_ref ( ) , arg_types)
89+ . return_dtype ( self . options . deref ( ) , arg_types)
90+ }
91+
92+ /// Evaluate the expression, returning an ArrayRef.
93+ ///
94+ /// NOTE: this function will soon be deprecated as all expressions will evaluate trivially
95+ /// into an ExprArray.
96+ pub fn evaluate ( & self , expr : & Expression , scope : & ArrayRef ) -> VortexResult < ArrayRef > {
97+ self . vtable . as_dyn ( ) . evaluate ( expr, scope)
8798 }
8899
89100 /// Execute the expression given the input arguments.
90101 pub fn execute ( & self , ctx : ExecutionArgs ) -> VortexResult < Datum > {
91- self . vtable . as_dyn ( ) . execute ( self . options . as_ref ( ) , ctx)
102+ self . vtable . as_dyn ( ) . execute ( self . options . deref ( ) , ctx)
92103 }
93104}
94105
95106impl Clone for BoundExpression {
96107 fn clone ( & self ) -> Self {
97108 BoundExpression {
98109 vtable : self . vtable . clone ( ) ,
99- options : self . vtable . as_dyn ( ) . options_clone ( self . options . as_ref ( ) ) ,
110+ options : self . vtable . as_dyn ( ) . options_clone ( self . options . deref ( ) ) ,
100111 }
101112 }
102113}
@@ -110,7 +121,7 @@ impl Debug for BoundExpression {
110121 & DebugWith ( |fmt| {
111122 self . vtable
112123 . as_dyn ( )
113- . options_debug ( self . options . as_ref ( ) , fmt)
124+ . options_debug ( self . options . deref ( ) , fmt)
114125 } ) ,
115126 )
116127 . finish ( )
@@ -122,7 +133,7 @@ impl Display for BoundExpression {
122133 write ! ( f, "{}(" , self . vtable. id( ) ) ?;
123134 self . vtable
124135 . as_dyn ( )
125- . options_display ( self . options . as_ref ( ) , f) ?;
136+ . options_display ( self . options . deref ( ) , f) ?;
126137 write ! ( f, ")" )
127138 }
128139}
@@ -133,7 +144,7 @@ impl PartialEq for BoundExpression {
133144 && self
134145 . vtable
135146 . as_dyn ( )
136- . options_eq ( self . options . as_ref ( ) , other. options . as_ref ( ) )
147+ . options_eq ( self . options . deref ( ) , other. options . deref ( ) )
137148 }
138149}
139150impl Eq for BoundExpression { }
@@ -143,6 +154,6 @@ impl Hash for BoundExpression {
143154 self . vtable . hash ( state) ;
144155 self . vtable
145156 . as_dyn ( )
146- . options_hash ( self . options . as_ref ( ) , state) ;
157+ . options_hash ( self . options . deref ( ) , state) ;
147158 }
148159}
0 commit comments