mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-27 06:06:19 +00:00
refactor: merge catalog provider & schema provider into catalog manager (#1803)
* move to expr_factory Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * move configs into service_config Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * move GrpcQueryHandler into distributed.rs Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix compile and test in catalog sub-crate Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * clean up Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix table-procedure compile and test Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix query compile and tests Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix datanode compile and tests Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix catalog/query/script/servers compile Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix frontend compile Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix nextest except information_schema Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * support information_schema Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix sqlness test Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix merge errors Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * remove other structs Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * clean up Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix format Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * change deregister_table's return type to empty tuple Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -69,6 +69,7 @@ table = { path = "../table" }
|
||||
tokio.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
catalog = { path = "../catalog", features = ["testing"] }
|
||||
common-test-util = { path = "../common/test-util" }
|
||||
log-store = { path = "../log-store" }
|
||||
mito = { path = "../mito", features = ["test"] }
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use catalog::local::{MemoryCatalogProvider, MemorySchemaProvider};
|
||||
use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME};
|
||||
use catalog::local::MemoryCatalogManager;
|
||||
use common_query::Output;
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use futures::Future;
|
||||
@@ -50,22 +49,10 @@ where
|
||||
}
|
||||
|
||||
pub(crate) fn sample_script_engine() -> PyEngine {
|
||||
let catalog_list = catalog::local::new_memory_catalog_list().unwrap();
|
||||
|
||||
let default_schema = Arc::new(MemorySchemaProvider::new());
|
||||
default_schema
|
||||
.register_table_sync("numbers".to_string(), Arc::new(NumbersTable::default()))
|
||||
.unwrap();
|
||||
let default_catalog = Arc::new(MemoryCatalogProvider::new());
|
||||
default_catalog
|
||||
.register_schema_sync(DEFAULT_SCHEMA_NAME.to_string(), default_schema)
|
||||
.unwrap();
|
||||
catalog_list
|
||||
.register_catalog_sync(DEFAULT_CATALOG_NAME.to_string(), default_catalog)
|
||||
.unwrap();
|
||||
|
||||
let factory = QueryEngineFactory::new(catalog_list, false);
|
||||
let query_engine = factory.query_engine();
|
||||
let catalog_manager = Arc::new(MemoryCatalogManager::new_with_table(Arc::new(
|
||||
NumbersTable::default(),
|
||||
)));
|
||||
let query_engine = QueryEngineFactory::new(catalog_manager, false).query_engine();
|
||||
|
||||
PyEngine::new(query_engine.clone())
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@ mod tests {
|
||||
.await
|
||||
.unwrap(),
|
||||
);
|
||||
catalog_manager.start().await.unwrap();
|
||||
|
||||
let factory = QueryEngineFactory::new(catalog_manager.clone(), false);
|
||||
let query_engine = factory.query_engine();
|
||||
|
||||
@@ -357,8 +357,7 @@ pub(crate) use tests::sample_script_engine;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use catalog::local::{MemoryCatalogProvider, MemorySchemaProvider};
|
||||
use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME};
|
||||
use catalog::local::MemoryCatalogManager;
|
||||
use common_recordbatch::util;
|
||||
use datatypes::prelude::ScalarVector;
|
||||
use datatypes::value::Value;
|
||||
@@ -369,22 +368,10 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
pub(crate) fn sample_script_engine() -> PyEngine {
|
||||
let catalog_list = catalog::local::new_memory_catalog_list().unwrap();
|
||||
|
||||
let default_schema = Arc::new(MemorySchemaProvider::new());
|
||||
default_schema
|
||||
.register_table_sync("numbers".to_string(), Arc::new(NumbersTable::default()))
|
||||
.unwrap();
|
||||
let default_catalog = Arc::new(MemoryCatalogProvider::new());
|
||||
default_catalog
|
||||
.register_schema_sync(DEFAULT_SCHEMA_NAME.to_string(), default_schema)
|
||||
.unwrap();
|
||||
catalog_list
|
||||
.register_catalog_sync(DEFAULT_CATALOG_NAME.to_string(), default_catalog)
|
||||
.unwrap();
|
||||
|
||||
let factory = QueryEngineFactory::new(catalog_list, false);
|
||||
let query_engine = factory.query_engine();
|
||||
let catalog_manager = Arc::new(MemoryCatalogManager::new_with_table(Arc::new(
|
||||
NumbersTable::default(),
|
||||
)));
|
||||
let query_engine = QueryEngineFactory::new(catalog_manager, false).query_engine();
|
||||
|
||||
PyEngine::new(query_engine.clone())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user