use datafusion::logical_expr::Expr;
#[derive(Clone, Debug, Default)]
pub struct FilterApplication {
pub fully_handled: Vec<usize>,
pub partially_handled: Vec<usize>,
}
#[derive(Clone, Debug, Default)]
pub struct ProjectionApplication {
pub keep: Vec<String>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TopNScope {
Local,
Global,
}
#[derive(Clone, Debug)]
pub struct TopNApplication {
pub applied: TopNScope,
}
#[derive(Clone, Debug, Default)]
pub struct AggregateApplication {
pub fully_handled: Vec<usize>,
pub returns_partial_state: bool,
}
pub trait SupportsFilterPushdown {
fn push_filters(&self, filters: &[Expr]) -> FilterApplication;
}
pub trait SupportsProjectionPushdown {
fn push_projection(&self, columns: &[String]) -> ProjectionApplication;
}
pub trait SupportsLimitPushdown {
fn push_limit(&self, limit: usize) -> Option<usize>;
}
#[derive(Clone, Debug)]
pub struct SortExpr {
pub column: String,
pub ascending: bool,
pub nulls_first: bool,
}
pub trait SupportsTopNPushdown {
fn push_topn(&self, sort: &[SortExpr], k: usize) -> Option<TopNApplication>;
}
pub trait SupportsAggregatePushdown {
fn push_aggregates(&self, group_by: &[Expr], aggs: &[Expr]) -> AggregateApplication;
}