From 1f316402f3a2876c352e167f2e73167cf98c2422 Mon Sep 17 00:00:00 2001 From: kamille Date: Fri, 18 Aug 2023 15:23:03 +0800 Subject: [PATCH] remove unused code. --- .../datafusion_impl/logical_optimizer/mod.rs | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/query_engine/src/datafusion_impl/logical_optimizer/mod.rs b/query_engine/src/datafusion_impl/logical_optimizer/mod.rs index 3ef090d50a..b945ae8f10 100644 --- a/query_engine/src/datafusion_impl/logical_optimizer/mod.rs +++ b/query_engine/src/datafusion_impl/logical_optimizer/mod.rs @@ -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; -} - -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 { - // 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 }) - } -}