use risinglight_proto::rowset::block_statistics::BlockStatisticsType;
use super::index::ColumnIndex;
use crate::types::DataValue;
mod row_count;
use row_count::*;
mod distinct_value;
use distinct_value::*;
mod statistics_builder;
pub use statistics_builder::*;
pub trait StatisticsGlobalAgg {
fn apply_batch(&mut self, index: &ColumnIndex);
fn get_output(&self) -> DataValue;
}
pub fn create_statistics_global_aggregator(
ty: BlockStatisticsType,
) -> Box<dyn StatisticsGlobalAgg> {
match ty {
BlockStatisticsType::RowCount => Box::new(RowCountGlobalAgg::create()),
BlockStatisticsType::DistinctValue => Box::new(DistinctValueGlobalAgg::create()),
}
}