Skip to content

docs(physical-plan): add doctest examples for StatisticsRegistry, ExtendedStatistics, and compute_extended - #25699

Merged
kosiew merged 4 commits into
apache:mainfrom
asolimando:asolimando/extended-statistics-docs
Oct 7, 2026
Merged

kosiew merged 4 commits into
apache:mainfrom
asolimando:asolimando/extended-statistics-docs

Conversation

@asolimando

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #25698.

Rationale for this change

StatisticsRegistry and ExtendedStatistics each had a # Example doc block wrapped in
```ignore, so it was never compiled or checked by cargo test --doc.
StatisticsContext::compute_extended had no example at all.

What changes are included in this PR?

  • Add a real, compiled # Example to StatisticsContext::compute_extended.
  • Convert the StatisticsRegistry module doc example from ignore to a real doctest.
  • Convert the ExtendedStatistics struct doc example from ignore to a real doctest.
  • The shared running example is a cross-column correlation extension
    (ColumnCorrelation), since it is a genuinely node-level statistic, unlike a
    per-column histogram, which has no home in the current single node-level
    Extensions field.

Are these changes tested?

Yes, each doc comment is now a doctest, verified by cargo test --doc.

Are there any user-facing changes?

No, this is a documentation-only change to public API doc comments.


Disclaimer: I used AI to assist in the code generation, I have manually reviewed the output and it matches my intention and understanding.

…endedStatistics, and compute_extended

Add real, compiled `# Example` doctests to `StatisticsContext::compute_extended`,
the `StatisticsRegistry` module doc, and the `ExtendedStatistics` struct doc.

The `StatisticsRegistry`/`ExtendedStatistics` examples were previously wrapped in
` ```ignore ` blocks referencing undefined names, so they were never compiled or
checked. `compute_extended` had no example at all.

The shared running example is a cross-column correlation extension
(`ColumnCorrelation`), a real, node-level statistic (unlike a per-column
histogram, which has no home in the current single node-level `Extensions`
field).

Closes apache#25698.
@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Sep 24, 2026
@codecov-commenter

codecov-commenter commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.70%. Comparing base (c3ef346) to head (2bc67a1).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25699      +/-   ##
==========================================
+ Coverage   82.66%   82.70%   +0.04%     
==========================================
  Files        1147     1147              
  Lines      446357   447631    +1274     
  Branches   446357   447631    +1274     
==========================================
+ Hits       368971   370217    +1246     
+ Misses      54997    54924      -73     
- Partials    22389    22490     +101     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Prefix the use statements in the compute_extended, StatisticsRegistry,
and ExtendedStatistics doctests with # so they compile but do not show
in the rendered documentation, per alamb's review on PR apache#25689.
…-statistics-docs

# Conflicts:
#	datafusion/physical-plan/src/statistics.rs
@asolimando

Copy link
Copy Markdown
Member Author

@kosiew I wonder if you would be interested into reviewing this, since you were the main reviewer of this code and you have recently touched StatisticsRegistry doc after your follow-up improvements over the cache life-time

@kosiew kosiew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@asolimando,

Thanks for working on this. The doctest coverage looks good, and I did not find any blocking issues. I left one optional documentation suggestion.

Comment thread datafusion/physical-plan/src/statistics.rs
…tended doctest

Also demonstrates reading the coefficient, not just the column indexes.
Addresses kosiew's review suggestion on PR apache#25699.
@asolimando
asolimando requested a review from kosiew October 6, 2026 08:05
@kosiew

kosiew commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🚀
@asolimando
Thank you for your contribution.

@kosiew
kosiew added this pull request to the merge queue Oct 7, 2026
Merged via the queue into apache:main with commit e8535d3 Oct 7, 2026
42 checks passed
@asolimando
asolimando deleted the asolimando/extended-statistics-docs branch October 9, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate v56.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve documentation for StatisticsRegistry, ExtendedStatistics, and StatisticsContext::compute_extended

3 participants