-
Notifications
You must be signed in to change notification settings - Fork 487
Rework ExprPrepStyle to trait #34415
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
base: main
Are you sure you want to change the base?
Conversation
749a780 to
458a032
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors ExprPrepStyle from an enum into a trait-based design with specific implementations. The refactoring separates the different expression preparation behaviors into distinct types (ExprPrepStyleMaintained, ExprPrepStyleOneShot, ExprPrepStyleWebhookValidation, and NoopExprPrepStyle), eliminating the need for pattern matching in the preparation logic. This change improves code organization and makes it easier to extend expression preparation behaviors in the future.
Key changes:
- Converted
ExprPrepStylefrom an enum to a trait withprep_relation_exprandprep_scalar_exprmethods - Created four concrete implementations of the trait for different preparation contexts
- Updated all call sites to use the new trait-based API by calling methods on style instances rather than passing styles as parameters
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/adapter/src/optimize/dataflows.rs | Core refactoring: defines the ExprPrepStyle trait and implements it for four specific styles |
| src/adapter/src/optimize/view.rs | Updates Optimizer to be generic over ExprPrepStyle implementations |
| src/adapter/src/webhook.rs | Updates webhook validation to use ExprPrepStyleWebhookValidation |
| src/adapter/src/optimize/peek.rs | Switches peek optimization to use ExprPrepStyleOneShot |
| src/adapter/src/optimize/subscribe.rs | Updates subscribe optimization to use ExprPrepStyleMaintained |
| src/adapter/src/optimize/materialized_view.rs | Updates materialized view optimization to use ExprPrepStyleMaintained |
| src/adapter/src/optimize/index.rs | Updates index optimization to use ExprPrepStyleMaintained |
| src/adapter/src/optimize/copy_to.rs | Updates copy_to optimization to use ExprPrepStyleOneShot |
| src/adapter/src/coord/sequencer/inner/secret.rs | Updates secret handling to use ExprPrepStyleOneShot |
| src/adapter/src/coord/sequencer/inner/copy_from.rs | Updates copy_from handling to use ExprPrepStyleOneShot |
| src/adapter/src/coord/sequencer/inner.rs | Updates transaction handling to use ExprPrepStyleOneShot |
| src/adapter/src/coord/sequencer.rs | Updates URI evaluation to use ExprPrepStyleOneShot |
| src/adapter/src/client.rs | Updates client code to use ExprPrepStyleOneShot |
| src/adapter/src/catalog.rs | Updates catalog tests to use ExprPrepStyleOneShot |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mostly nits, but there is one question about ExprPrepStyleWebhookValidation, which I think accidentally changed behavior.
Changes the `ExprPrepStyle` enum to a trait with specific implementations. This cleans up the implementation, and would allow for easier sharing of optimizer calls in the future. Signed-off-by: Moritz Hoffmann <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Moritz Hoffmann <[email protected]>
c28a010 to
3a012fa
Compare
teskje
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes the
ExprPrepStyleenum to a trait with specific implementations. This cleans up the implementation, and would allow for easier sharing of optimizer calls in the future. Otherwise, there are not behavior changes.