Skip to content

Commit

Permalink
refactor: remove SqlStatementExecutor (GreptimeTeam#2464)
Browse files Browse the repository at this point in the history
Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia authored and paomian committed Oct 19, 2023
1 parent 53e5651 commit ebfa01b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 45 deletions.
16 changes: 0 additions & 16 deletions src/datanode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<common_query::Output> {
unreachable!()
}
}
22 changes: 1 addition & 21 deletions src/datanode/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<HeartbeatMailbox>,
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 {
Expand Down
8 changes: 0 additions & 8 deletions src/query/src/query_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<dyn SqlStatementExecutor>;

/// Describe statement result
#[derive(Debug)]
pub struct DescribeResult {
Expand All @@ -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<Output>;
}

#[async_trait]
pub trait QueryEngine: Send + Sync {
/// Returns the query engine as Any
Expand Down

0 comments on commit ebfa01b

Please sign in to comment.