Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove SqlStatementExecutor #2464

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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