// start implementing uses
use arrow::datatypes::DataType;
use datafusion::common::Result;
use datafusion::logical_expr::{ColumnarValue, ScalarUDFImpl, Signature};
use std::any::Any;
// end implementing uses
#[derive(Debug)]
pub(super) struct Func {
signature: Signature,
}
impl Func {
pub fn new() -> Self {
// start implementing constructor
// Example
// use DataType::*;
// Self {
// signature:
// Signature::one_of(
// vec![Exact(vec![Float32]), Exact(vec![Float64])],
// Volatility::Immutable,
// )
// }
todo!()
// end implementing constructor
}
}
impl ScalarUDFImpl for Func {
fn as_any(&self) -> &dyn Any {
self
}
fn name(&self) -> &str {
"{{ name }}"
}
fn signature(&self) -> &Signature {
&self.signature
}
// start implementing return_type
fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
todo!()
}
// end implementing return_type
// start implementing invoke
fn invoke(&self, _args: &[ColumnarValue]) -> Result<ColumnarValue> {
todo!()
}
// end implementing invoke
}
// start implementing footer
// end implementing footer