Skip to content

Commit

Permalink
remove unused code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint committed Aug 18, 2023
1 parent 28fdd6e commit 1f31640
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions query_engine/src/datafusion_impl/logical_optimizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,3 @@
#[cfg(test)]
pub mod tests;
pub mod type_conversion;

use datafusion::prelude::SessionContext;
use generic_error::BoxError;
use query_frontend::plan::QueryPlan;
use snafu::ResultExt;

use crate::error::*;

/// LogicalOptimizer transform the QueryPlan into a potentially more efficient
/// plan
pub trait LogicalOptimizer {
// TODO(yingwen): Maybe support other plans
fn optimize(&mut self, plan: QueryPlan) -> Result<QueryPlan>;
}

pub struct LogicalOptimizerImpl {
ctx: SessionContext,
}

impl LogicalOptimizerImpl {
pub fn with_context(ctx: SessionContext) -> Self {
Self { ctx }
}
}

impl LogicalOptimizer for LogicalOptimizerImpl {
fn optimize(&mut self, plan: QueryPlan) -> Result<QueryPlan> {
// TODO(yingwen): Avoid clone the plan multiple times during optimization
let QueryPlan {
mut df_plan,
tables,
} = plan;
df_plan = self
.ctx
.state()
.optimize(&df_plan)
.box_err()
.context(LogicalOptimizerWithCause { msg: None })?;

Ok(QueryPlan { df_plan, tables })
}
}

0 comments on commit 1f31640

Please sign in to comment.