Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented May 3, 2024

(this has 4 lines of code change and the rest are test updates to remove &)

Which issue does this PR close?

Part of #9637

Rationale for this change

The current Analyzer::execute_and_check API requires cloning a LogicalPlan

What changes are included in this PR?

  1. Change Analyzer::execute_and_check to take an owned plan (and thus the caller to do the clone if they don't have one)

Are these changes tested?

CI

Note I expect this to have a limited impact on performance as the higher level APIs (e.g. SessionState::optimize still take a &LogicalPlan) but at least the lower level APIs wont

Are there any user-facing changes?

@alamb alamb added the api change Changes the API exposed to users of the crate label May 3, 2024
@github-actions github-actions bot added optimizer Optimizer rules core Core DataFusion crate labels May 3, 2024
// analyze & capture output of each rule
let analyzer_result = self.analyzer.execute_and_check(
e.plan.as_ref(),
e.plan.as_ref().clone(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where the cloning happens now (at the callsite)

pub fn execute_and_check<F>(
&self,
plan: &LogicalPlan,
plan: LogicalPlan,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the API change and the clone is removed

@alamb alamb marked this pull request as ready for review May 3, 2024 14:44
Copy link
Contributor

@jayzhan211 jayzhan211 left a comment

Choose a reason for hiding this comment

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

👍

@alamb alamb merged commit 1f23703 into apache:main May 5, 2024
@alamb alamb deleted the alamb/less_copy_analyzer branch May 5, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change Changes the API exposed to users of the crate core Core DataFusion crate optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants