chore: Deprecate internal-only APIs in AggregateExec - #25257
2010YOUY01 wants to merge 1 commit into
Conversation
|
Not sure if there are better approaches for this case, it we have to do this way, we can later doc this pattern in |
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25257 +/- ##
==========================================
- Coverage 81.88% 81.88% -0.01%
==========================================
Files 1133 1133
Lines 424522 424522
Branches 424522 424522
==========================================
- Hits 347622 347615 -7
- Misses 56288 56291 +3
- Partials 20612 20616 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| /// Clone this exec, overriding only the limit hint. | ||
| /// |
There was a problem hiding this comment.
This file has the only change (deprecation)
Other diff are all mechanical changes like #expect(deprecated) at call sites.
Building and rewriting an `AggregateExec` is how DataFusion's own physical optimizer rules work, not something external consumers should reach for. Hide that whole surface from the rendered docs, as apache#25257 does for the methods it deprecates: - the deprecated `with_limit_options`, `with_new_limit_options` and `with_new_aggr_exprs` - their replacements, `AggregateExec::builder`, `AggregateExec::to_builder` and `AggregateExecBuilder` itself - the `limit_options` getter `limit_options` is hidden but deliberately not deprecated: it has no replacement, reading the limit of an aggregate is safe, and deprecating it would only force `#[expect(deprecated)]` back into the optimizer rule that copies a limit between aggregates. Doc links from the still-public `AggregateExec::try_new` and `LimitOptions` into the hidden items are now plain code spans, since a link to a hidden item renders as a dead anchor. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PwTc51ca2XHDCyVB7MbJoz
|
@2010YOUY01 I'm curious what you think of #25376 as an alternative? It's a larger change but it prevents us from hitting these bugs / makes bad states unrepresentable even for internal users of these APIs. |
Building and rewriting an `AggregateExec` is how DataFusion's own physical optimizer rules work, not something external consumers should reach for. Hide that whole surface from the rendered docs, as apache#25257 does for the methods it deprecates: - the deprecated `with_limit_options`, `with_new_limit_options` and `with_new_aggr_exprs` - their replacements, `AggregateExec::builder`, `AggregateExec::to_builder` and `AggregateExecBuilder` itself - the `limit_options` getter `limit_options` is hidden but deliberately not deprecated: it has no replacement, reading the limit of an aggregate is safe, and deprecating it would only force `#[expect(deprecated)]` back into the optimizer rule that copies a limit between aggregates. Doc links from the still-public `AggregateExec::try_new` and `LimitOptions` into the hidden items are now plain code spans, since a link to a hidden item renders as a dead anchor. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PwTc51ca2XHDCyVB7MbJoz
`with_limit_options`, `with_new_limit_options` and `with_new_aggr_exprs` each clone the node with one field replaced and leave the caller to know which of the other twelve fields that field feeds. Deprecate them in favour of the builder. Building and rewriting an `AggregateExec` is how DataFusion's own physical optimizer rules work, not a public API, so the whole surface is `#[doc(hidden)]`: the builder, `AggregateExec::builder`, `AggregateExec::to_builder`, the three deprecated methods, and the `limit_options` getter. The getter is not deprecated, because reading a limit is safe and has no replacement. This is what apache#25257 asked for, with a replacement to point callers at and no `#[expect(deprecated)]` left inside DataFusion. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D7arPq4Frxu8byr17mqVKA
I thought about the same approach at first, and didn't do it simply because it feels like a lot of work. So definitely +1, closing this PR for this safer alternative. |
`with_limit_options`, `with_new_limit_options` and `with_new_aggr_exprs` each clone the node with one field replaced and leave the caller to know which of the other twelve fields that field feeds. Deprecate them in favour of the builder. Building and rewriting an `AggregateExec` is how DataFusion's own physical optimizer rules work, not a public API, so the whole surface is `#[doc(hidden)]`: the builder, `AggregateExec::builder`, `AggregateExec::to_builder`, the three deprecated methods, and the `limit_options` getter. The getter is not deprecated, because reading a limit is safe and has no replacement. This is what apache#25257 asked for, with a replacement to point callers at and no `#[expect(deprecated)]` left inside DataFusion. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D7arPq4Frxu8byr17mqVKA
Which issue does this PR close?
Rationale for this change
AggregateExec::{with_new_limit_options, with_limit_options, limit_options}set a limit hint on an aggregation. This is part of the public API forAggregateExecIt's nearly impossible to use it correctly (see below code explanation) if we see it as a public
ExecutionPlanAPI, however it requirespubbecause physical optimizer requires it.This PR does:
#[doc(hidden)]. That is the usual Rust convention for "public for technical reasons, not for external user": the item is dropped from generated docs (docs.rs)What changes are included in this PR?
What is the testing strategy for this PR?
Are there any user-facing changes?
Yes, deprecations.