use async_trait::async_trait;
use datafusion::{
execution::context::{FunctionFactory, RegisterFunction, SessionState},
logical_expr::CreateFunction,
};
use crate::error::ExonError;
#[derive(Default, Debug)]
pub struct ExonFunctionFactory {}
#[async_trait]
impl FunctionFactory for ExonFunctionFactory {
async fn create(
&self,
_state: &SessionState,
statement: CreateFunction,
) -> datafusion::error::Result<RegisterFunction> {
let CreateFunction {
temporary: _,
name,
args: _,
return_type: _,
params: _,
schema: _,
or_replace: _,
} = statement;
Err(ExonError::UnsupportedFunction(name.clone()).into())
}
}