From eb484265f8f757a5172ea3abafa03c72a0754d9e Mon Sep 17 00:00:00 2001 From: Zhenchi Date: Mon, 11 Sep 2023 07:03:26 +0000 Subject: [PATCH] chore: nit change Signed-off-by: Zhenchi --- src/frontend/src/delete.rs | 18 +++++++++--------- src/frontend/src/insert.rs | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/frontend/src/delete.rs b/src/frontend/src/delete.rs index 047029860538..e22cd57d1121 100644 --- a/src/frontend/src/delete.rs +++ b/src/frontend/src/delete.rs @@ -39,13 +39,13 @@ use crate::error::{ }; use crate::req_convert::delete::{ColumnToRow, RowToRegion, TableToRegion}; -pub(crate) struct Deleter { +pub struct Deleter { catalog_manager: CatalogManagerRef, partition_manager: PartitionRuleManagerRef, datanode_manager: DatanodeManagerRef, } -pub(crate) type DeleterRef = Arc; +pub type DeleterRef = Arc; impl Deleter { pub fn new( @@ -126,12 +126,12 @@ impl Deleter { .await? .into_iter() .map(|(peer, deletes)| { + let request = RegionRequest { + header: Some(RegionRequestHeader { trace_id, span_id }), + body: Some(region_request::Body::Deletes(deletes)), + }; let datanode_manager = self.datanode_manager.clone(); common_runtime::spawn_write(async move { - let request = RegionRequest { - header: Some(RegionRequestHeader { trace_id, span_id }), - body: Some(region_request::Body::Deletes(deletes)), - }; datanode_manager .datanode(&peer) .await @@ -181,9 +181,9 @@ impl Deleter { ctx: &QueryContextRef, ) -> Result { for req in &mut requests.deletes { - let table = self - .get_table(ctx.current_catalog(), ctx.current_schema(), &req.table_name) - .await?; + let catalog = ctx.current_catalog(); + let schema = ctx.current_schema(); + let table = self.get_table(catalog, schema, &req.table_name).await?; let key_column_names = self.key_column_names(&table)?; let rows = req.rows.as_mut().unwrap(); diff --git a/src/frontend/src/insert.rs b/src/frontend/src/insert.rs index 1308b76e63d3..4821ecaec667 100644 --- a/src/frontend/src/insert.rs +++ b/src/frontend/src/insert.rs @@ -49,13 +49,13 @@ use crate::expr_factory::CreateExprFactory; use crate::req_convert::insert::{ColumnToRow, RowToRegion, StatementToRegion, TableToRegion}; use crate::statement::StatementExecutor; -pub(crate) struct Inserter { +pub struct Inserter { catalog_manager: CatalogManagerRef, partition_manager: PartitionRuleManagerRef, datanode_manager: DatanodeManagerRef, } -pub(crate) type InserterRef = Arc; +pub type InserterRef = Arc; impl Inserter { pub fn new( @@ -157,12 +157,12 @@ impl Inserter { .await? .into_iter() .map(|(peer, inserts)| { + let request = RegionRequest { + header: Some(RegionRequestHeader { trace_id, span_id }), + body: Some(region_request::Body::Inserts(inserts)), + }; let datanode_manager = self.datanode_manager.clone(); common_runtime::spawn_write(async move { - let request = RegionRequest { - header: Some(RegionRequestHeader { trace_id, span_id }), - body: Some(region_request::Body::Inserts(inserts)), - }; datanode_manager .datanode(&peer) .await