Copilot commented on code in PR #53729:
URL: https://github.com/apache/doris/pull/53729#discussion_r2230049611


##########
be/src/vec/exec/scan/file_scanner.cpp:
##########
@@ -1617,6 +1636,51 @@ void FileScanner::try_stop() {
     }
 }
 
+void FileScanner::update_realtime_counters() {
+    pipeline::FileScanLocalState* local_state =
+            static_cast<pipeline::FileScanLocalState*>(_local_state);
+
+    COUNTER_UPDATE(local_state->_scan_bytes, _file_reader_stats->read_bytes);
+    COUNTER_UPDATE(local_state->_scan_rows, _file_reader_stats->read_rows);
+
+    _state->get_query_ctx()->resource_ctx()->io_context()->update_scan_rows(
+            _file_reader_stats->read_rows);
+    _state->get_query_ctx()->resource_ctx()->io_context()->update_scan_bytes(
+            _file_reader_stats->read_bytes);
+
+    if (_file_cache_statistics->bytes_read_from_local == 0 &&
+        _file_cache_statistics->bytes_read_from_remote == 0) {
+        _state->get_query_ctx()
+                ->resource_ctx()
+                ->io_context()
+                
->update_scan_bytes_from_remote_storage(_file_reader_stats->read_bytes);
+        DorisMetrics::instance()->query_scan_bytes_from_local->increment(

Review Comment:
   Inconsistent metrics reporting: the code updates remote storage bytes in the 
IOContext but increments local bytes in DorisMetrics when there's no cache. 
Both should be consistent - either local or remote.
   ```suggestion
           DorisMetrics::instance()->query_scan_bytes_from_remote->increment(
   ```



##########
be/src/vec/exec/scan/file_scanner.cpp:
##########
@@ -1617,6 +1636,51 @@ void FileScanner::try_stop() {
     }
 }
 
+void FileScanner::update_realtime_counters() {
+    pipeline::FileScanLocalState* local_state =
+            static_cast<pipeline::FileScanLocalState*>(_local_state);
+
+    COUNTER_UPDATE(local_state->_scan_bytes, _file_reader_stats->read_bytes);
+    COUNTER_UPDATE(local_state->_scan_rows, _file_reader_stats->read_rows);
+
+    _state->get_query_ctx()->resource_ctx()->io_context()->update_scan_rows(
+            _file_reader_stats->read_rows);
+    _state->get_query_ctx()->resource_ctx()->io_context()->update_scan_bytes(
+            _file_reader_stats->read_bytes);
+
+    if (_file_cache_statistics->bytes_read_from_local == 0 &&
+        _file_cache_statistics->bytes_read_from_remote == 0) {
+        _state->get_query_ctx()
+                ->resource_ctx()
+                ->io_context()
+                
->update_scan_bytes_from_remote_storage(_file_reader_stats->read_bytes);

Review Comment:
   When file cache statistics show no local or remote reads, the code 
incorrectly updates remote storage bytes with total read bytes. This should 
update local storage bytes since the comment indicates 'In case of no cache, we 
still need to update the IO stats'.
   ```suggestion
                   
->update_scan_bytes_from_local_storage(_file_reader_stats->read_bytes);
   ```



##########
be/src/vec/exec/format/orc/vorc_reader.cpp:
##########
@@ -2817,10 +2810,10 @@ void 
ORCFileInputStream::_build_large_ranges_input_stripe_streams(
         std::unordered_map<orc::StreamId, std::shared_ptr<InputStream>>& 
streams) {
     for (const auto& range : ranges) {
         auto stripe_stream_input_stream = 
std::make_shared<StripeStreamInputStream>(
-                getName(), _file_reader, _statistics, _io_ctx, _profile);
-        streams.emplace(range.first,
-                        std::make_shared<StripeStreamInputStream>(getName(), 
_file_reader,
-                                                                  _statistics, 
_io_ctx, _profile));
+                getName(),
+                std::make_shared<io::TracingFileReader>(_file_reader, 
_io_ctx->file_reader_stats),

Review Comment:
   The code creates a `StripeStreamInputStream` with the wrong number of 
parameters. The constructor expects `(file_name, file_reader, io_ctx, profile)` 
but is being called with `(getName(), tracing_file_reader, _io_ctx, _profile)` 
where `getName()` should be the first parameter, not a separate line.
   ```suggestion
                   getName(), 
std::make_shared<io::TracingFileReader>(_file_reader, 
_io_ctx->file_reader_stats),
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to