vlorql-core 0.5.0

A high-performance SQL query optimizer with constant folding, predicate pushdown, column pruning, and cost-based join reordering
Documentation
use super::{CompiledQuery, DialectConfig, QueryBuilder, SqlCompiler};
use crate::errors::VlorQLError;
use crate::schema::SqlDialect;
use crate::validate::ValidatedPlan;

#[derive(Debug, Clone, Copy, Default)]
pub struct SQLiteCompiler;

impl SqlCompiler for SQLiteCompiler {
    fn compile(&self, plan: &ValidatedPlan) -> Result<CompiledQuery, VlorQLError> {
        let config = DialectConfig::default_sqlite();
        let (sql, parameters) = QueryBuilder::new(plan, &config)?.build()?;
        Ok(CompiledQuery {
            sql,
            parameters,
            dialect: self.dialect(),
        })
    }

    fn dialect(&self) -> SqlDialect {
        SqlDialect::Sqlite
    }
}