#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum AggregateStrategy {
HashAggregate,
SortAggregate,
StreamingAggregate,
}
impl AggregateStrategy {
pub fn name(&self) -> &'static str {
match self {
AggregateStrategy::HashAggregate => "HashAggregate",
AggregateStrategy::SortAggregate => "SortAggregate",
AggregateStrategy::StreamingAggregate => "StreamingAggregate",
}
}
}
#[derive(Debug, Clone)]
pub struct AggregateStrategyDecision {
pub strategy: AggregateStrategy,
pub estimated_output_rows: u64,
pub estimated_cost: f64,
pub estimated_memory_bytes: u64,
pub reason: SelectionReason,
}
#[derive(Debug, Clone)]
pub enum SelectionReason {
InputAlreadySorted,
HighCardinality,
LowCardinality,
MemoryConstrained,
SmallDataSet,
LargeDataSet,
CostBased { hash_cost: f64, sort_cost: f64 },
}