From a7c5a5315493fe5816c82d96c61587230b92bef4 Mon Sep 17 00:00:00 2001 From: dantengsky Date: Sat, 21 Oct 2023 14:16:58 +0800 Subject: [PATCH] chore: more status info during building `DataSourcePlan` (#13368) * more status info while build DataSourcePlan * adjust status message --- src/query/sql/src/executor/table_read_plan.rs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/query/sql/src/executor/table_read_plan.rs b/src/query/sql/src/executor/table_read_plan.rs index 53dde459fa4c..1b4f70651b09 100644 --- a/src/query/sql/src/executor/table_read_plan.rs +++ b/src/query/sql/src/executor/table_read_plan.rs @@ -88,6 +88,8 @@ impl ToReadDataSourcePlan for dyn Table { ) -> Result { let catalog_info = ctx.get_catalog(&catalog).await?.info(); + let start = std::time::Instant::now(); + let (statistics, parts) = if let Some(PushDownInfo { filters: Some(Filters { @@ -103,11 +105,16 @@ impl ToReadDataSourcePlan for dyn Table { { Ok((PartStatistics::default(), Partitions::default())) } else { - ctx.set_status_info("build physical plan - read partitions"); + ctx.set_status_info("build physical plan - reading partitions"); self.read_partitions(ctx.clone(), push_downs.clone(), dry_run) .await }?; + ctx.set_status_info(&format!( + "build physical plan - got data source partitions, time used {:?}", + start.elapsed() + )); + ctx.incr_total_scan_value(ProgressValues { rows: statistics.read_rows, bytes: statistics.read_bytes, @@ -182,6 +189,10 @@ impl ToReadDataSourcePlan for dyn Table { let column_not_null = !ctx.get_settings().get_ddl_column_type_nullable()?; for (i, field) in output_schema.fields().iter().enumerate() { if let Some(mask_policy) = column_mask_policy.get(field.name()) { + ctx.set_status_info(&format!( + "build physical plan - checking data mask policies - getting data masks, time used {:?}", + start.elapsed()) + ); if let Ok(policy) = handler .get_data_mask( meta_api.clone(), @@ -230,6 +241,10 @@ impl ToReadDataSourcePlan for dyn Table { false, ); + ctx.set_status_info( + &format!("build physical plan - checking data mask policies - resolving mask expression, time used {:?}", + start.elapsed()) + ); let scalar = type_checker.resolve(&ast_expr).await?; let expr = scalar.0.as_expr()?.project_column_ref(|col| col.index); mask_policy_map.insert(i, expr.as_remote_expr()); @@ -246,6 +261,11 @@ impl ToReadDataSourcePlan for dyn Table { } else { None }; + + ctx.set_status_info(&format!( + "build physical plan - built data source plan, time used {:?}", + start.elapsed() + )); // TODO pass in catalog name Ok(DataSourcePlan {