Skip to content

Conversation

@antiguru
Copy link
Member

@antiguru antiguru commented Dec 9, 2025

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. Otherwise, there are not behavior changes.

@antiguru antiguru requested review from a team as code owners December 9, 2025 14:27
@antiguru antiguru requested review from aljoscha and ggevay December 9, 2025 14:27
@antiguru antiguru requested a review from Copilot December 9, 2025 14:44
Copy link

Copilot AI left a 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 ExprPrepStyle from an enum to a trait with prep_relation_expr and prep_scalar_expr methods
  • 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.

@antiguru antiguru requested a review from teskje December 10, 2025 10:03
Copy link
Contributor

@teskje teskje left a 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.

antiguru and others added 3 commits December 16, 2025 15:16
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]>
Signed-off-by: Moritz Hoffmann <[email protected]>
Copy link
Contributor

@teskje teskje left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants