diff --git a/Cargo.toml b/Cargo.toml index 79b527104b9c..884960bd624c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -183,7 +183,7 @@ auth = { path = "src/auth" } cache = { path = "src/cache" } catalog = { path = "src/catalog" } client = { path = "src/client" } -cmd = { path = "src/cmd" } +cmd = { path = "src/cmd", default-features = false } common-base = { path = "src/common/base" } common-catalog = { path = "src/common/catalog" } common-config = { path = "src/common/config" } @@ -213,7 +213,7 @@ datanode = { path = "src/datanode" } datatypes = { path = "src/datatypes" } file-engine = { path = "src/file-engine" } flow = { path = "src/flow" } -frontend = { path = "src/frontend" } +frontend = { path = "src/frontend", default-features = false } index = { path = "src/index" } log-store = { path = "src/log-store" } meta-client = { path = "src/meta-client" } diff --git a/src/cmd/Cargo.toml b/src/cmd/Cargo.toml index ded9025709d3..5385577c2e0b 100644 --- a/src/cmd/Cargo.toml +++ b/src/cmd/Cargo.toml @@ -10,7 +10,9 @@ name = "greptime" path = "src/bin/greptime.rs" [features] +default = ["python"] tokio-console = ["common-telemetry/tokio-console"] +python = ["frontend/python"] [lints] workspace = true @@ -47,7 +49,7 @@ either = "1.8" etcd-client.workspace = true file-engine.workspace = true flow.workspace = true -frontend.workspace = true +frontend = { workspace = true, default-features = false } futures.workspace = true human-panic = "1.2.2" lazy_static.workspace = true diff --git a/src/frontend/src/error.rs b/src/frontend/src/error.rs index 1b6aa0655dfe..c925b2ea1a4f 100644 --- a/src/frontend/src/error.rs +++ b/src/frontend/src/error.rs @@ -274,6 +274,7 @@ pub enum Error { location: Location, }, + #[cfg(feature = "python")] #[snafu(display("Failed to start script manager"))] StartScriptManager { #[snafu(implicit)] @@ -438,6 +439,7 @@ impl ErrorExt for Error { Error::External { source, .. } => source.status_code(), Error::FindTableRoute { source, .. } => source.status_code(), + #[cfg(feature = "python")] Error::StartScriptManager { source, .. } => source.status_code(), Error::TableOperation { source, .. } => source.status_code(), diff --git a/src/frontend/src/script.rs b/src/frontend/src/script.rs index a3126cb2d772..91f793b69743 100644 --- a/src/frontend/src/script.rs +++ b/src/frontend/src/script.rs @@ -13,18 +13,14 @@ // limitations under the License. use std::collections::HashMap; -use std::sync::Arc; use catalog::CatalogManagerRef; -use common_error::ext::ErrorExt; use common_query::Output; use query::QueryEngineRef; -use servers::query_handler::grpc::GrpcQueryHandler; use session::context::QueryContextRef; -use crate::error::{Error, Result}; - -type FrontendGrpcQueryHandlerRef = Arc + Send + Sync>; +use crate::error::Result; +use crate::instance::Instance; #[cfg(not(feature = "python"))] mod dummy { @@ -40,7 +36,7 @@ mod dummy { Ok(Self {}) } - pub fn start(&self, instance: &Instance) -> Result<()> { + pub fn start(&self, _instance: &Instance) -> Result<()> { Ok(()) } @@ -66,12 +62,14 @@ mod dummy { #[cfg(feature = "python")] mod python { + use std::sync::Arc; + use api::v1::ddl_request::Expr; use api::v1::greptime_request::Request; use api::v1::DdlRequest; use arc_swap::ArcSwap; use catalog::RegisterSystemTableRequest; - use common_error::ext::BoxedError; + use common_error::ext::{BoxedError, ErrorExt}; use common_telemetry::{error, info}; use script::manager::ScriptManager; use servers::query_handler::grpc::GrpcQueryHandler; @@ -80,8 +78,9 @@ mod python { use table::table_name::TableName; use super::*; - use crate::error::{CatalogSnafu, TableNotFoundSnafu}; - use crate::instance::Instance; + use crate::error::{CatalogSnafu, Error, TableNotFoundSnafu}; + + type FrontendGrpcQueryHandlerRef = Arc + Send + Sync>; /// A placeholder for the real gRPC handler. /// It is temporary and will be replaced soon.