#[derive(Debug, Clone)]
pub struct AggregateContext {
pub input_rows: u64,
pub group_keys: Vec<String>,
pub agg_function_count: usize,
pub memory_limit: u64,
pub input_is_sorted: bool,
pub sort_keys_match_group_keys: bool,
pub is_deterministic: bool,
pub complexity_score: u32,
pub table_name: Option<String>,
}
impl AggregateContext {
pub fn new(input_rows: u64, group_keys: Vec<String>, agg_function_count: usize) -> Self {
Self {
input_rows,
group_keys,
agg_function_count,
memory_limit: 0,
input_is_sorted: false,
sort_keys_match_group_keys: false,
is_deterministic: true,
complexity_score: 0,
table_name: None,
}
}
pub fn with_memory_limit(mut self, memory_limit: u64) -> Self {
self.memory_limit = memory_limit;
self
}
pub fn with_sorted_input(mut self, sort_keys_match: bool) -> Self {
self.input_is_sorted = true;
self.sort_keys_match_group_keys = sort_keys_match;
self
}
pub fn with_expression_analysis(
mut self,
is_deterministic: bool,
complexity_score: u32,
) -> Self {
self.is_deterministic = is_deterministic;
self.complexity_score = complexity_score;
self
}
pub fn with_table_name(mut self, table_name: Option<String>) -> Self {
self.table_name = table_name;
self
}
}