Make LogicalPlan::with_new_exprs,
deprecate from_plan
#7396
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
related to #7359
Rationale for this change
While reviewing a great documentation improvement from @tshauck it took me a while to find the
from_plan
function used to rewrite LogicalPlans. See #7359 (comment)I think this makes it harder to work with the DataFusion codebase unnecessarily.
The reason it took me a while to find I think was
LogicalPlan
(it is in a utility module).expr
orexprs
in its nameThus, given it takes a
&LogicalPlan
as its first input I think it makes sense and would be more easily findable as a method onLogicalPlan
.It also turns out
from_plan
forcesExpr
s to be copied even when most callsites already have a copy of those exprsWhat changes are included in this PR?
from_plan
toLogicalPlan::with_new_exprs()
from_plan
new_with_exprs
(see second commit in this PR)Note that
LogicalPlan::new_with_exprs
take aVec<Expr>
instead of&[Expr]
likefrom_plan
as it needs the owned Exprs anywaysAre these changes tested?
By existing tests
Are there any user-facing changes?
New API, deprecated old one