use crate::algebra::Algebra;
use super::queryexecutor_type::QueryExecutor;
impl QueryExecutor {
#[allow(clippy::only_used_in_recursion)]
pub(super) fn estimate_complexity(&self, algebra: &Algebra) -> usize {
match algebra {
Algebra::Bgp(patterns) => patterns.len(),
Algebra::Join { left, right } => {
1 + self.estimate_complexity(left) + self.estimate_complexity(right)
}
Algebra::Union { left, right } => {
1 + self.estimate_complexity(left) + self.estimate_complexity(right)
}
Algebra::Filter { pattern, .. } => 1 + self.estimate_complexity(pattern),
_ => 1,
}
}
}