Skip to content

Commit

Permalink
chore: adjust the orgnization of creator/dropper files
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiKaiWi committed Oct 14, 2022
1 parent b6ff10d commit c5ceabf
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ use table_engine::engine::TableEngineRef;

use crate::{
context::Context,
create::table_creator::TableCreatorRef,
interpreter::{Create, Interpreter, InterpreterPtr, Output, Result as InterpreterResult},
table_creator::TableCreatorRef,
};

pub mod table_creator;

#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum Error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use table_engine::engine::{TableEngineRef, TableState};
use crate::{
context::Context,
create::{
CatalogNotExists, FindCatalog, FindSchema, Result, SchemaCreateTable, SchemaNotExists,
table_creator::TableCreator, CatalogNotExists, FindCatalog, FindSchema, Result,
SchemaCreateTable, SchemaNotExists,
},
interpreter::Output,
table_creator::TableCreator,
};

pub struct TableCreatorImpl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use async_trait::async_trait;
use sql::plan::CreateTablePlan;
use table_engine::engine::TableEngineRef;

use crate::{context::Context, create::Result, interpreter::Output, table_creator::TableCreator};
use crate::{
context::Context,
create::{table_creator::TableCreator, Result},
interpreter::Output,
};

pub struct TableCreatorImpl {}

Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion interpreters/src/drop.rs → interpreters/src/drop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ use table_engine::engine::TableEngineRef;

use crate::{
context::Context,
drop::table_dropper::TableDropperRef,
interpreter::{Drop, Interpreter, InterpreterPtr, Output, Result as InterpreterResult},
table_dropper::TableDropperRef,
};

pub mod table_dropper;

#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum Error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ use table_engine::engine::TableEngineRef;

use crate::{
context::Context,
drop::{CatalogNotExists, FindCatalog, FindSchema, Result, SchemaDropTable, SchemaNotExists},
drop::{
table_dropper::TableDropper, CatalogNotExists, FindCatalog, FindSchema, Result,
SchemaDropTable, SchemaNotExists,
},
interpreter::Output,
table_dropper::TableDropper,
};

pub struct TableDropperImpl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use async_trait::async_trait;
use sql::plan::DropTablePlan;
use table_engine::engine::TableEngineRef;

use crate::{context::Context, drop::Result, interpreter::Output, table_dropper::TableDropper};
use crate::{
context::Context,
drop::{table_dropper::TableDropper, Result},
interpreter::Output,
};

pub struct TableDropperImpl {}

Expand Down
File renamed without changes.
14 changes: 10 additions & 4 deletions interpreters/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ use sql::plan::Plan;
use table_engine::engine::TableEngineRef;

use crate::{
alter_table::AlterTableInterpreter, context::Context, create::CreateInterpreter,
describe::DescribeInterpreter, drop::DropInterpreter, exists::ExistsInterpreter,
insert::InsertInterpreter, interpreter::InterpreterPtr, select::SelectInterpreter,
show::ShowInterpreter, table_creator::TableCreatorRef, table_dropper::TableDropperRef,
alter_table::AlterTableInterpreter,
context::Context,
create::{table_creator::TableCreatorRef, CreateInterpreter},
describe::DescribeInterpreter,
drop::{table_dropper::TableDropperRef, DropInterpreter},
exists::ExistsInterpreter,
insert::InsertInterpreter,
interpreter::InterpreterPtr,
select::SelectInterpreter,
show::ShowInterpreter,
};

/// A factory to create interpreters
Expand Down
2 changes: 0 additions & 2 deletions interpreters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ pub mod insert;
pub mod interpreter;
pub mod select;
pub mod show;
pub mod table_creator;
pub mod table_dropper;

mod show_create;

Expand Down
4 changes: 2 additions & 2 deletions interpreters/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ use table_engine::engine::TableEngineRef;

use crate::{
context::Context,
create::table_creator::catalog_based::TableCreatorImpl,
drop::table_dropper::catalog_based::TableDropperImpl,
factory::Factory,
interpreter::{Output, Result},
table_creator::catalog_based::TableCreatorImpl,
table_dropper::catalog_based::TableDropperImpl,
};

async fn build_catalog_manager(analytic: TableEngineRef) -> TableBasedManager {
Expand Down
2 changes: 1 addition & 1 deletion server/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::sync::Arc;

use catalog::manager::ManagerRef;
use df_operator::registry::FunctionRegistryRef;
use interpreters::{table_creator::TableCreatorRef, table_dropper::TableDropperRef};
use interpreters::{create::table_creator::TableCreatorRef, drop::table_dropper::TableDropperRef};
use table_engine::engine::TableEngineRef;

use crate::limiter::Limiter;
Expand Down
2 changes: 1 addition & 1 deletion server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::sync::Arc;
use catalog::manager::ManagerRef;
use cluster::ClusterRef;
use df_operator::registry::FunctionRegistryRef;
use interpreters::{table_creator, table_dropper};
use interpreters::{create::table_creator, drop::table_dropper};
use log::warn;
use query_engine::executor::Executor as QueryExecutor;
use snafu::{Backtrace, OptionExt, ResultExt, Snafu};
Expand Down

0 comments on commit c5ceabf

Please sign in to comment.