Skip to content

docs: Document WindowFn and add comments - #24118

Open
alamb wants to merge 6 commits into
apache:mainfrom
alamb:alamb/document-window-fn
Open

docs: Document WindowFn and add comments#24118
alamb wants to merge 6 commits into
apache:mainfrom
alamb:alamb/document-window-fn

Conversation

@alamb

@alamb alamb commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • N/A (documentation only)

Rationale for this change

The WindowFn enum in datafusion-physical-expr has no documentation, and its Builtin variant name is misleading:

What changes are included in this PR?

Doc comments on WindowFn and its two variants, including links to the WindowExpr implementations that create each variant.

Are these changes tested?

By CI

Are there any user-facing changes?

Improved API documentation only; no code changes.

@github-actions github-actions Bot added the physical-expr Changes to the physical-expr crates label Aug 5, 2026
@alamb
alamb force-pushed the alamb/document-window-fn branch from b7418cb to 69c5f08 Compare August 5, 2026 19:43
@alamb alamb changed the title docs: Document WindowFn and its variants docs: Rename WindowFn to WindowFnState and add comments Aug 5, 2026
@alamb
alamb force-pushed the alamb/document-window-fn branch from 69c5f08 to eaa18f9 Compare August 5, 2026 19:46
@alamb alamb changed the title docs: Rename WindowFn to WindowFnState and add comments docs: Dcument WindowFn and add comments Aug 5, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@alamb
alamb force-pushed the alamb/document-window-fn branch from eaa18f9 to f368ba0 Compare August 5, 2026 19:48
/// State for incrementally evaluating a window function
/// within a partition, created by [`WindowExpr::create_window_fn`].
#[derive(Debug)]
pub enum WindowFn {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This struct is not technically pub as it is in a mod (not `pub mod), though it somehow appears in the WindowExpr trait 🤷

It might be nice to fix the naming but I think for now just documenting it is helpful

https://docs.rs/datafusion/latest/datafusion/physical_expr/window/trait.WindowExpr.html#tymethod.create_window_fn

@alamb alamb added the documentation Improvements or additions to documentation label Aug 5, 2026
@alamb
alamb marked this pull request as ready for review August 7, 2026 21:08
@alamb alamb changed the title docs: Dcument WindowFn and add comments docs: Document WindowFn and add comments Aug 7, 2026
@codecov-commenter

codecov-commenter commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.14%. Comparing base (bbb552f) to head (96772ff).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24118      +/-   ##
==========================================
- Coverage   81.14%   81.14%   -0.01%     
==========================================
  Files        1110     1110              
  Lines      386137   386137              
  Branches   386137   386137              
==========================================
- Hits       313347   313334      -13     
- Misses      54324    54335      +11     
- Partials    18466    18468       +2     

☔ 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.

@github-actions github-actions Bot removed the documentation Improvements or additions to documentation label Aug 8, 2026

@nuno-faria nuno-faria 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.

Thanks @alamb, LGTM. One question: here "partition" refers to the logical partitions of the window function and not concurrency partitions right?

Comment on lines +618 to +619
/// [`PartitionEvaluator`]. Despite the name, it is used for all window
/// function that is not an aggregate function.

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.

nit: "... for all window function that is not aggregate function" -> "for all window functions that are not aggregate functions"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great idea -- done in 00cfe5b

@alamb
alamb enabled auto-merge August 12, 2026 21:28
@alamb

alamb commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the review @nuno-faria

@alamb
alamb added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants