From ebfa01b333713b773d0851e5c4bd94b0fa8944c0 Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Fri, 22 Sep 2023 09:57:48 +0800 Subject: [PATCH] refactor: remove SqlStatementExecutor (#2464) Signed-off-by: Ruihang Xia --- src/datanode/src/lib.rs | 16 ---------------- src/datanode/src/tests.rs | 22 +--------------------- src/query/src/query_engine.rs | 8 -------- 3 files changed, 1 insertion(+), 45 deletions(-) diff --git a/src/datanode/src/lib.rs b/src/datanode/src/lib.rs index 890e5c38ce92..62a9bd9f309a 100644 --- a/src/datanode/src/lib.rs +++ b/src/datanode/src/lib.rs @@ -15,8 +15,6 @@ #![feature(assert_matches)] #![feature(trait_upcasting)] -use query::query_engine::SqlStatementExecutor; - pub mod alive_keeper; pub mod config; pub mod datanode; @@ -31,17 +29,3 @@ mod store; #[cfg(test)] #[allow(dead_code)] mod tests; - -// TODO(ruihang): remove this -pub struct Instance; - -#[async_trait::async_trait] -impl SqlStatementExecutor for Instance { - async fn execute_sql( - &self, - _stmt: sql::statements::statement::Statement, - _query_ctx: session::context::QueryContextRef, - ) -> query::error::Result { - unreachable!() - } -} diff --git a/src/datanode/src/tests.rs b/src/datanode/src/tests.rs index 3407390b463a..43a06b34db96 100644 --- a/src/datanode/src/tests.rs +++ b/src/datanode/src/tests.rs @@ -23,7 +23,7 @@ use common_meta::heartbeat::handler::{ HeartbeatResponseHandlerContext, HeartbeatResponseHandlerExecutor, }; use common_meta::heartbeat::mailbox::{HeartbeatMailbox, MessageMeta}; -use common_meta::instruction::{Instruction, InstructionReply, OpenRegion, RegionIdent}; +use common_meta::instruction::{Instruction, OpenRegion, RegionIdent}; use common_query::prelude::ScalarUdf; use common_query::Output; use common_runtime::Runtime; @@ -34,29 +34,9 @@ use query::query_engine::DescribeResult; use query::QueryEngine; use session::context::QueryContextRef; use table::TableRef; -use tokio::sync::mpsc::{self, Receiver}; use crate::event_listener::NoopRegionServerEventListener; use crate::region_server::RegionServer; -use crate::Instance; - -struct HandlerTestGuard { - instance: Instance, - mailbox: Arc, - rx: Receiver<(MessageMeta, InstructionReply)>, -} - -async fn prepare_handler_test(_name: &str) -> HandlerTestGuard { - let instance = Instance; - let (tx, rx) = mpsc::channel(8); - let mailbox = Arc::new(HeartbeatMailbox::new(tx)); - - HandlerTestGuard { - instance, - mailbox, - rx, - } -} pub fn test_message_meta(id: u64, subject: &str, to: &str, from: &str) -> MessageMeta { MessageMeta { diff --git a/src/query/src/query_engine.rs b/src/query/src/query_engine.rs index b0dde22c36c3..b18834d2c8ec 100644 --- a/src/query/src/query_engine.rs +++ b/src/query/src/query_engine.rs @@ -28,7 +28,6 @@ use common_query::prelude::ScalarUdf; use common_query::Output; use datatypes::schema::Schema; use session::context::QueryContextRef; -use sql::statements::statement::Statement; use table::TableRef; use crate::dataframe::DataFrame; @@ -40,8 +39,6 @@ pub use crate::query_engine::context::QueryEngineContext; pub use crate::query_engine::state::QueryEngineState; use crate::region_query::RegionQueryHandlerRef; -pub type SqlStatementExecutorRef = Arc; - /// Describe statement result #[derive(Debug)] pub struct DescribeResult { @@ -51,11 +48,6 @@ pub struct DescribeResult { pub logical_plan: LogicalPlan, } -#[async_trait] -pub trait SqlStatementExecutor: Send + Sync { - async fn execute_sql(&self, stmt: Statement, query_ctx: QueryContextRef) -> Result; -} - #[async_trait] pub trait QueryEngine: Send + Sync { /// Returns the query engine as Any