use crate::{AisleError, Expr};
#[derive(Clone, Debug, Default)]
pub struct AisleResult {
pub(crate) prunable: Vec<Expr>,
pub(crate) errors: Vec<AisleError>,
}
impl AisleResult {
pub(crate) fn prunable(&self) -> &[Expr] {
&self.prunable
}
#[cfg(feature = "datafusion")]
pub(crate) fn push_prunable(&mut self, expr: Expr) {
self.prunable.push(expr);
}
#[cfg(feature = "datafusion")]
pub(crate) fn push_error(&mut self, err: AisleError) {
self.errors.push(err);
}
pub fn ir_exprs(&self) -> &[Expr] {
&self.prunable
}
pub fn from_ir_exprs(exprs: Vec<Expr>) -> Self {
Self {
prunable: exprs,
errors: Vec::new(),
}
}
pub fn from_ir_slice(exprs: &[Expr]) -> Self {
Self {
prunable: exprs.to_vec(),
errors: Vec::new(),
}
}
pub fn errors(&self) -> &[AisleError] {
&self.errors
}
pub fn has_errors(&self) -> bool {
!self.errors.is_empty()
}
pub fn prunable_count(&self) -> usize {
self.prunable.len()
}
pub fn error_count(&self) -> usize {
self.errors.len()
}
}