Skip to content

Commit

Permalink
chore: more status info during building DataSourcePlan (databendlab…
Browse files Browse the repository at this point in the history
…s#13368)

* more status info while build DataSourcePlan

* adjust status message
  • Loading branch information
dantengsky authored Oct 21, 2023
1 parent 46d2e86 commit a7c5a53
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/query/sql/src/executor/table_read_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ impl ToReadDataSourcePlan for dyn Table {
) -> Result<DataSourcePlan> {
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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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());
Expand All @@ -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 {
Expand Down

0 comments on commit a7c5a53

Please sign in to comment.