use vortex_array::scalar_fn::ScalarFnVTable;
use vortex_array::scalar_fn::ScalarFnVTableExt;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;
use crate::BoundExpression;
use crate::Expression;
pub trait ScalarFnExprExt: ScalarFnVTable {
fn new_expr(
&self,
options: Self::Options,
children: impl IntoIterator<Item = Expression>,
) -> Expression {
Self::try_new_expr(self, options, children).vortex_expect("Failed to create expression")
}
fn try_new_expr(
&self,
options: Self::Options,
children: impl IntoIterator<Item = Expression>,
) -> VortexResult<Expression> {
Expression::try_new(self.bind(options), children)
}
fn try_new_bound_expr(
&self,
options: Self::Options,
children: impl IntoIterator<Item = BoundExpression>,
) -> VortexResult<BoundExpression> {
BoundExpression::try_new(self.bind(options), children)
}
}
impl<V: ScalarFnVTable> ScalarFnExprExt for V {}