Skip to content

Commit 84cc1b4

Browse files
authored
chore: polish log for copy. (#15463)
* chore: add query_id in log. * chore: polish log for copy.
1 parent 0001c82 commit 84cc1b4

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/query/sql/src/planner/binder/binder.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use databend_common_expression::Expr;
3636
use databend_common_functions::BUILTIN_FUNCTIONS;
3737
use databend_common_meta_app::principal::StageFileFormatType;
3838
use indexmap::IndexMap;
39-
use log::info;
4039
use log::warn;
4140

4241
use super::Finder;
@@ -136,7 +135,10 @@ impl<'a> Binder {
136135
let mut init_bind_context = BindContext::new();
137136
let plan = self.bind_statement(&mut init_bind_context, stmt).await?;
138137
self.bind_query_index(&mut init_bind_context, &plan).await?;
139-
info!("bind stmt to plan, time used: {:?}", start.elapsed());
138+
self.ctx.set_status_info(&format!(
139+
"bind stmt to plan done, time used: {:?}",
140+
start.elapsed()
141+
));
140142
Ok(plan)
141143
}
142144

src/query/sql/src/planner/plans/copy_into_table.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ impl CopyIntoTablePlan {
189189
return Err(ErrorCode::Internal(COPY_MAX_FILES_COMMIT_MSG));
190190
}
191191
info!(
192-
"force mode, ignore file filtering. ({}.{})",
193-
&self.database_name, &self.table_name
192+
"{}: force mode, ignore file filtering. ({}.{})",
193+
ctx.get_id(),
194+
&self.database_name,
195+
&self.table_name
194196
);
195197
(all_source_file_infos, vec![])
196198
} else {
@@ -225,11 +227,16 @@ impl CopyIntoTablePlan {
225227
(files_to_copy, duplicated_files)
226228
};
227229

230+
let len = need_copy_file_infos.len();
231+
let sum: u64 = need_copy_file_infos.iter().map(|i| i.size).sum();
232+
228233
info!(
229-
"copy: read files with max_files={:?} finished, all:{}, need copy:{}, elapsed:{:?}",
234+
"{}: collect files with max_files={:?} finished, need to copy {} files, {} bytes; skip {} duplicated files, time used:{:?}",
235+
ctx.get_id(),
230236
max_files,
231-
num_all_files,
232237
need_copy_file_infos.len(),
238+
num_all_files - len,
239+
sum,
233240
start.elapsed()
234241
);
235242

0 commit comments

Comments
 (0)