Skip to content

Commit 328dcb4

Browse files
committed
refactor(config): dedup query config inner/outer
1 parent 081742d commit 328dcb4

File tree

62 files changed

+680
-1316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+680
-1316
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/query/catalog/src/catalog/manager.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use std::sync::Arc;
1818
use chrono::Utc;
1919
use databend_common_base::base::BuildInfoRef;
2020
use databend_common_base::base::GlobalInstance;
21-
use databend_common_config::CatalogConfig;
2221
use databend_common_config::InnerConfig;
2322
use databend_common_exception::ErrorCode;
2423
use databend_common_exception::Result;
@@ -107,11 +106,19 @@ impl CatalogManager {
107106
// init external catalogs.
108107
let mut external_catalogs = HashMap::default();
109108
for (name, ctl_cfg) in conf.catalogs.iter() {
110-
let CatalogConfig::Hive(hive_ctl_cfg) = ctl_cfg;
111109
let creator = catalog_creators.get(&CatalogType::Hive).ok_or_else(|| {
112110
ErrorCode::BadArguments(format!("unknown catalog type: {:?}", CatalogType::Hive))
113111
})?;
114112

113+
if ctl_cfg.ty.as_str() != "hive" {
114+
return Err(ErrorCode::CatalogNotSupported(format!(
115+
"got unsupported catalog type in config: {}",
116+
ctl_cfg.ty
117+
)));
118+
}
119+
120+
let hive_ctl_cfg = &ctl_cfg.hive;
121+
115122
let ctl_info = CatalogInfo {
116123
id: CatalogIdIdent::new(&tenant, 0).into(),
117124
name_ident: CatalogNameIdent::new(tenant.clone(), name).into(),

src/query/config/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ serfig = { workspace = true }
3434
toml = { workspace = true }
3535

3636
[dev-dependencies]
37+
temp-env = { workspace = true }
3738

3839
[lints]
3940
workspace = true

0 commit comments

Comments
 (0)