mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-26 18:00:41 +00:00
perf: change current schema and catalog to borrow, clone only necessary (#2116)
perf: change current schema and catalog to borrow, clone only when necessary Co-authored-by: gongzhengyang <gongzhengyang@bolean.com.cn>
This commit is contained in:
@@ -109,9 +109,9 @@ impl DatafusionQueryEngine {
|
||||
}
|
||||
);
|
||||
|
||||
let default_catalog = query_ctx.current_catalog();
|
||||
let default_schema = query_ctx.current_schema();
|
||||
let table_name = dml.table_name.resolve(&default_catalog, &default_schema);
|
||||
let default_catalog = &query_ctx.current_catalog().to_owned();
|
||||
let default_schema = &query_ctx.current_schema().to_owned();
|
||||
let table_name = dml.table_name.resolve(default_catalog, default_schema);
|
||||
let table = self.find_table(&table_name).await?;
|
||||
|
||||
let output = self
|
||||
|
||||
@@ -99,7 +99,7 @@ pub async fn show_databases(
|
||||
query_ctx: QueryContextRef,
|
||||
) -> Result<Output> {
|
||||
let mut databases = catalog_manager
|
||||
.schema_names(&query_ctx.current_catalog())
|
||||
.schema_names(query_ctx.current_catalog())
|
||||
.await
|
||||
.context(error::CatalogSnafu)?;
|
||||
|
||||
@@ -143,11 +143,11 @@ pub async fn show_tables(
|
||||
let schema = if let Some(database) = stmt.database {
|
||||
database
|
||||
} else {
|
||||
query_ctx.current_schema()
|
||||
query_ctx.current_schema().to_owned()
|
||||
};
|
||||
// TODO(sunng87): move this function into query_ctx
|
||||
let mut tables = catalog_manager
|
||||
.table_names(&query_ctx.current_catalog(), &schema)
|
||||
.table_names(query_ctx.current_catalog(), &schema)
|
||||
.await
|
||||
.context(error::CatalogSnafu)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user