use super::partition_evaluator::PartitionEvaluator;
use crate::PhysicalExpr;
use arrow::array::ArrayRef;
use arrow::datatypes::Field;
use arrow::record_batch::RecordBatch;
use datafusion_common::Result;
use std::any::Any;
use std::sync::Arc;
pub trait BuiltInWindowFunctionExpr: Send + Sync + std::fmt::Debug {
fn as_any(&self) -> &dyn Any;
fn field(&self) -> Result<Field>;
fn expressions(&self) -> Vec<Arc<dyn PhysicalExpr>>;
fn name(&self) -> &str {
"BuiltInWindowFunctionExpr: default name"
}
fn evaluate_args(&self, batch: &RecordBatch) -> Result<Vec<ArrayRef>> {
self.expressions()
.iter()
.map(|e| e.evaluate(batch))
.map(|r| r.map(|v| v.into_array(batch.num_rows())))
.collect()
}
fn create_evaluator(&self) -> Result<Box<dyn PartitionEvaluator>>;
fn reverse_expr(&self) -> Option<Arc<dyn BuiltInWindowFunctionExpr>> {
None
}
fn supports_bounded_execution(&self) -> bool {
false
}
fn uses_window_frame(&self) -> bool {
false
}
}