From 303181e835a31da23f3dd0e1b9c108536ff5ca9c Mon Sep 17 00:00:00 2001 From: wenzhenghu Date: Wed, 16 Jul 2025 17:18:43 +0800 Subject: [PATCH] [refactor](file-cache) refactor statistics collection logic in VFileScanner --- be/src/vec/exec/scan/vfile_scanner.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/be/src/vec/exec/scan/vfile_scanner.cpp b/be/src/vec/exec/scan/vfile_scanner.cpp index a22777672b6b4f..65cdd097b50a10 100644 --- a/be/src/vec/exec/scan/vfile_scanner.cpp +++ b/be/src/vec/exec/scan/vfile_scanner.cpp @@ -1186,10 +1186,18 @@ void VFileScanner::try_stop() { void VFileScanner::_collect_profile_before_close() { VScanner::_collect_profile_before_close(); - if (config::enable_file_cache && _state->query_options().enable_file_cache && - _profile != nullptr) { - io::FileCacheProfileReporter cache_profile(_profile); - cache_profile.update(_file_cache_statistics.get()); + if (config::enable_file_cache && _state->query_options().enable_file_cache) { + if (_profile != nullptr) { + io::FileCacheProfileReporter cache_profile(_profile); + cache_profile.update(_file_cache_statistics.get()); + } + + if (_query_statistics) { + _query_statistics->add_scan_bytes_from_local_storage( + _file_cache_statistics->bytes_read_from_local); + _query_statistics->add_scan_bytes_from_remote_storage( + _file_cache_statistics->bytes_read_from_remote); + } } if (_cur_reader != nullptr) {