vortex_expr/
scalar_fn_ext.rs1use vortex_array::scalar_fn::ScalarFnVTable;
5use vortex_array::scalar_fn::ScalarFnVTableExt;
6use vortex_error::VortexExpect;
7use vortex_error::VortexResult;
8
9use crate::BoundExpression;
10use crate::Expression;
11
12pub trait ScalarFnExprExt: ScalarFnVTable {
14 fn new_expr(
16 &self,
17 options: Self::Options,
18 children: impl IntoIterator<Item = Expression>,
19 ) -> Expression {
20 Self::try_new_expr(self, options, children).vortex_expect("Failed to create expression")
21 }
22
23 fn try_new_expr(
25 &self,
26 options: Self::Options,
27 children: impl IntoIterator<Item = Expression>,
28 ) -> VortexResult<Expression> {
29 Expression::try_new(self.bind(options), children)
30 }
31
32 fn try_new_bound_expr(
34 &self,
35 options: Self::Options,
36 children: impl IntoIterator<Item = BoundExpression>,
37 ) -> VortexResult<BoundExpression> {
38 BoundExpression::try_new(self.bind(options), children)
39 }
40}
41impl<V: ScalarFnVTable> ScalarFnExprExt for V {}