Skip to content

Conversation

@dataroaring
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

Copilot AI review requested due to automatic review settings December 31, 2025 19:59
@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds builder statistics tracking to the scanner by modifying the get_segment_num_rows method to accept and populate an OlapReaderStatistics parameter. This enables collection of file cache statistics during segment metadata loading.

Key Changes:

  • Added get_segment_num_rows method to BetaRowset class with statistics parameter support
  • Modified ParallelScannerBuilder to track and expose builder statistics via builder_stats() accessor
  • Updated OlapScanOperator to report file cache statistics from the scanner builder to metrics and profiles

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
be/src/olap/rowset/beta_rowset.h Added get_segment_num_rows method declaration and member variables for caching segment rows using thread-safe DorisCallOnce pattern
be/src/olap/rowset/beta_rowset.cpp Implemented get_segment_num_rows method with lazy initialization of segment row counts and statistics tracking
be/src/olap/rowset/beta_rowset_reader.cpp Refactored to call BetaRowset::get_segment_num_rows instead of accessing internal state directly
be/src/olap/parallel_scanner_builder.h Added _builder_stats member and builder_stats() accessor method
be/src/olap/parallel_scanner_builder.cpp Updated to use new get_segment_num_rows API and pass statistics parameter
be/src/pipeline/exec/olap_scan_operator.cpp Added file cache profile reporting and metrics updates from builder statistics
be/test/olap/segcompaction_test.cpp Updated test calls to use new BetaRowset::get_segment_num_rows API with statistics parameter
be/test/olap/segcompaction_mow_test.cpp Updated test calls to use new BetaRowset::get_segment_num_rows API with statistics parameter
be/test/olap/rowid_conversion_test.cpp Updated test calls to use new BetaRowset::get_segment_num_rows API with statistics parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// Rows read from storage.
// Include the rows read from doris page cache.
_scan_rows = ADD_COUNTER(_runtime_profile, "ScanRows", TUnit::UNIT);
_scan_rows = ADD_COUNTER(custom_profile(), "ScanRows", TUnit::UNIT);
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call custom_profile() appears to be undefined. Looking at the surrounding code in this file, profile counters are typically added to _runtime_profile, _scanner_profile, or _segment_profile. The method custom_profile() is not defined in the base classes (PipelineXLocalStateBase, ScanLocalState, etc.) and this will likely cause a compilation error. This should probably be _runtime_profile instead to match the pattern used in line 69 and elsewhere in the codebase.

Suggested change
_scan_rows = ADD_COUNTER(custom_profile(), "ScanRows", TUnit::UNIT);
_scan_rows = ADD_COUNTER(_runtime_profile, "ScanRows", TUnit::UNIT);

Copilot uses AI. Check for mistakes.
@dataroaring
Copy link
Contributor Author

run buildall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants