Skip to main content

vortex_array/scalar_fn/
signature.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use crate::scalar_fn::Arity;
5use crate::scalar_fn::ChildName;
6use crate::scalar_fn::typed::DynScalarFn;
7
8/// Information about the signature of an expression.
9pub struct ScalarFnSignature<'a> {
10    pub(crate) inner: &'a dyn DynScalarFn,
11}
12
13impl ScalarFnSignature<'_> {
14    /// Returns the arity of this expression.
15    pub fn arity(&self) -> Arity {
16        self.inner.arity()
17    }
18
19    /// Returns the name of the nth child of this expression.
20    pub fn child_name(&self, index: usize) -> ChildName {
21        self.inner.child_name(index)
22    }
23
24    /// Returns whether this expression itself is null-sensitive.
25    /// See [`crate::scalar_fn::ScalarFnVTable::is_null_sensitive`].
26    pub fn is_null_sensitive(&self) -> bool {
27        self.inner.is_null_sensitive()
28    }
29
30    /// Returns whether this expression itself is fallible.
31    /// See [`crate::scalar_fn::ScalarFnVTable::is_fallible`].
32    pub fn is_fallible(&self) -> bool {
33        self.inner.is_fallible()
34    }
35}