use arrow_array::ArrayRef;
use arrow_schema::SchemaRef;
use datafusion::arrow::record_batch::RecordBatch;
use datafusion::logical_expr::Volatility;
use crate::errors::FnError;
use crate::traits::scalar::ArgType;
pub trait WindowPluginFn: Send + Sync {
fn signature(&self) -> &WindowSignature;
fn evaluate(&self, partition: &RecordBatch, frame: WindowFrame) -> Result<ArrayRef, FnError>;
}
#[derive(Clone, Debug)]
pub struct WindowSignature {
pub args: Vec<ArgType>,
pub returns: ArgType,
pub volatility: Volatility,
}
#[derive(Clone, Debug)]
pub struct WindowFrame {
pub schema: SchemaRef,
pub start: usize,
pub end: usize,
pub order_by_indices: Vec<usize>,
pub partition_by_indices: Vec<usize>,
}