Skip to content

sql: Add Eval and Columns traits for abstractly working with scalar expressions#36647

Merged
mgree merged 2 commits into
MaterializeInc:mainfrom
mgree:stable-lir-traits
May 26, 2026
Merged

sql: Add Eval and Columns traits for abstractly working with scalar expressions#36647
mgree merged 2 commits into
MaterializeInc:mainfrom
mgree:stable-lir-traits

Conversation

@mgree

@mgree mgree commented May 20, 2026

Copy link
Copy Markdown
Contributor

Motivation

https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/20260311_optimizer_customer_tradeoff.md

First PR split off of #36544.

Description

As we develop an LIR-level scalar expression, we will need to be able to (a) call eval() on those scalars and (b) ask questions about columns.

This PR introduces two traits that capture those behaviors, and refactors existing MIR-level MSE functions to work with those abstractions.

Verification

Pure refactor, should be all green.

@mgree mgree requested review from a team as code owners May 20, 2026 20:58
@mgree mgree requested review from antiguru and ggevay May 20, 2026 21:07

@ggevay ggevay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, just minor comments, but let's wait also for @antiguru's review.

Comment thread src/expr/src/scalar/eval.rs
Comment thread src/expr/src/scalar/func/eval.rs Outdated
Comment thread src/expr/src/scalar/func/macros.rs Outdated
Comment thread src/expr/src/interpret.rs
Comment thread src/expr/src/linear.rs Outdated

@antiguru antiguru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, thank you!

@mgree mgree merged commit 5d046b3 into MaterializeInc:main May 26, 2026
118 checks passed
@mgree

mgree commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

TFTRs!

@mgree mgree mentioned this pull request Jun 10, 2026
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.

3 participants