Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Remove ExecutionProps from OptimizerRule trait #2602

Closed

Conversation

andygrove
Copy link
Member

@andygrove andygrove commented May 23, 2022

Which issue does this PR close?

Part of #2599 and #2535

Rationale for this change

The logical optimizer rules should not depend on execution properties and only one of them currently does (SimplifyExpressions - which also depends on the physical query planner).

What changes are included in this PR?

  • Remove ExecutionProps from OptimizerRule
  • Add execution_props to SimplifyExpressions rule

Are there any user-facing changes?

No

Does this PR break compatibility with Ballista?

No

@andygrove andygrove self-assigned this May 23, 2022
@github-actions github-actions bot added the datafusion Changes in the datafusion crate label May 23, 2022
@@ -1130,7 +1130,7 @@ impl SessionConfig {
/// done so during predicate pruning and expression simplification
#[derive(Clone)]
pub struct ExecutionProps {
pub(crate) query_execution_start_time: DateTime<Utc>,
pub(crate) query_execution_start_time: Arc<Mutex<DateTime<Utc>>>,
Copy link
Member

Choose a reason for hiding this comment

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

I think this mutex is not needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. You are right, I have removed it.

SessionState {
session_id,
optimizers: vec![
// Simplify expressions first to maximize the chance
// of applying other optimizations
Arc::new(SimplifyExpressions::new()),
Arc::new(SimplifyExpressions::new(execution_props.clone())),
Copy link
Member Author

@andygrove andygrove May 24, 2022

Choose a reason for hiding this comment

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

~This is not correct. We need the same ExecutionProps to be shared between SessionState and SimplifyExpressions so that they both have the same execution start time. ~

@andygrove andygrove force-pushed the optimizer-remove-execution-props branch from 130e402 to 053c8a6 Compare May 24, 2022 15:10
@andygrove andygrove marked this pull request as draft May 24, 2022 15:14
@andygrove andygrove changed the title Remove ExecutionProps from OptimizerRule trait WIP: Remove ExecutionProps from OptimizerRule trait May 24, 2022
@andygrove
Copy link
Member Author

I'm moving this back to draft for now.

The SimplifyExpressions rule needs to access the "query execution start time" but the rule is created before the query starts executing so we need some way to get this dynamically.

Perhaps we need to provide the optimizer rules with a trait for accessing certain system state.

@andygrove andygrove closed this May 24, 2022
@andygrove andygrove deleted the optimizer-remove-execution-props branch January 27, 2023 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants