refactor: use DummyCatalog to construct query engine for datanode (#6723)

* refactor: use DummyCatalog to construct query engine for datanode

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* fix clippy

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* move to query/dummy_catalog

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

---------

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
This commit is contained in:
Zhenchi
2025-08-13 17:49:51 +08:00
committed by GitHub
parent a678b4dfd6
commit dea87b7e57
7 changed files with 115 additions and 24 deletions

View File

@@ -16,7 +16,6 @@ api.workspace = true
arrow-flight.workspace = true
async-trait.workspace = true
bytes.workspace = true
catalog.workspace = true
client.workspace = true
common-base.workspace = true
common-config.workspace = true

View File

@@ -18,7 +18,6 @@ use std::path::Path;
use std::sync::Arc;
use std::time::Duration;
use catalog::memory::MemoryCatalogManager;
use common_base::Plugins;
use common_error::ext::BoxedError;
use common_greptimedb_telemetry::GreptimeDBTelemetryTask;
@@ -44,7 +43,7 @@ use mito2::config::MitoConfig;
use mito2::engine::{MitoEngine, MitoEngineBuilder};
use object_store::manager::{ObjectStoreManager, ObjectStoreManagerRef};
use object_store::util::normalize_dir;
use query::dummy_catalog::TableProviderFactoryRef;
use query::dummy_catalog::{DummyCatalogManager, TableProviderFactoryRef};
use query::QueryEngineFactory;
use servers::export_metrics::ExportMetricsTask;
use servers::server::ServerHandlers;
@@ -377,7 +376,7 @@ impl DatanodeBuilder {
let query_engine_factory = QueryEngineFactory::new_with_plugins(
// query engine in datanode only executes plan with resolved table source.
MemoryCatalogManager::with_default_setup(),
DummyCatalogManager::arc(),
None,
None,
None,

View File

@@ -79,13 +79,6 @@ pub enum Error {
source: common_query::error::Error,
},
#[snafu(display("Catalog not found: {}", name))]
CatalogNotFound {
name: String,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Schema not found: {}", name))]
SchemaNotFound {
name: String,
@@ -159,13 +152,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Failed to access catalog"))]
Catalog {
#[snafu(implicit)]
location: Location,
source: catalog::error::Error,
},
#[snafu(display("Failed to initialize meta client"))]
MetaClientInit {
#[snafu(implicit)]
@@ -429,12 +415,10 @@ impl ErrorExt for Error {
InvalidSql { .. }
| IllegalPrimaryKeysDef { .. }
| MissingTimestampColumn { .. }
| CatalogNotFound { .. }
| SchemaNotFound { .. }
| SchemaExists { .. }
| MissingNodeId { .. }
| ColumnNoneDefaultValue { .. }
| Catalog { .. }
| MissingRequiredField { .. }
| RegionEngineNotFound { .. }
| ParseAddr { .. }

View File

@@ -248,7 +248,7 @@ impl RegionServer {
None
};
let ctx: Option<session::context::QueryContext> = request.header.as_ref().map(|h| h.into());
let ctx = request.header.as_ref().map(|h| h.into());
let query_ctx = Arc::new(ctx.unwrap_or_else(|| QueryContextBuilder::default().build()));
let provider = self