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

Refactor UnwrapCastInComparison to implement OptimizerRule::rewrite() #10087

Conversation

peter-toth
Copy link
Contributor

Which issue does this PR close?

Part of #9637.

Rationale for this change

Eliminates a LogicalPlan::with_new_exprs() call and so Expr cloning.

What changes are included in this PR?

This PR refactors UnwrapCastInComparison::try_optimize() to UnwrapCastInComparison::rewrite().

Are these changes tested?

Yes, with existing UTs.

Are there any user-facing changes?

No.

@github-actions github-actions bot added logical-expr Logical plan and expressions optimizer Optimizer rules labels Apr 15, 2024
@peter-toth peter-toth changed the title Refactor UnwrapCastInComparison to use rewrite() Refactor UnwrapCastInComparison to implement OptimizerRule::rewrite() Apr 15, 2024
@peter-toth peter-toth force-pushed the refactor-unwrap-cast-in-comparison-to-use-rewrite branch 2 times, most recently from d6e0c8f to 684fa0a Compare April 15, 2024 15:30
@peter-toth peter-toth marked this pull request as draft April 15, 2024 15:46
@peter-toth peter-toth force-pushed the refactor-unwrap-cast-in-comparison-to-use-rewrite branch from 684fa0a to 6c4256a Compare April 15, 2024 16:35
@peter-toth peter-toth force-pushed the refactor-unwrap-cast-in-comparison-to-use-rewrite branch from 6c4256a to 57605af Compare April 15, 2024 16:39
@github-actions github-actions bot removed the logical-expr Logical plan and expressions label Apr 15, 2024
@peter-toth peter-toth marked this pull request as ready for review April 15, 2024 17:18
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @peter-toth -- amazing how simple these PRs are now that we have the pattern down.- There are still some Expr copies left in the actual implementation I noticed, but this gets a bunch of the structural copying out of the way

Very nice

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.

👍

@jayzhan211
Copy link
Contributor

Thanks @peter-toth

@jayzhan211 jayzhan211 merged commit 6be3be4 into apache:main Apr 16, 2024
24 checks passed
@peter-toth
Copy link
Contributor Author

There are still some Expr copies left in the actual implementation I noticed, but this gets a bunch of the structural copying out of the way

I will try to eliminate those in a follow-up PR.

Thanks for the review @alamb, @jayzhan211!

Omega359 pushed a commit to Omega359/arrow-datafusion that referenced this pull request Apr 16, 2024
@peter-toth
Copy link
Contributor Author

@alamb, @jayzhan211 here is a follow-up PR to remove remaining Expr clones: #10115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants