Skip to content

expr: extend #[sqlfunc] to variadic functions and convert all eager variadics#34985

Merged
antiguru merged 33 commits intoMaterializeInc:mainfrom
antiguru:variadic_func
Mar 5, 2026
Merged

expr: extend #[sqlfunc] to variadic functions and convert all eager variadics#34985
antiguru merged 33 commits intoMaterializeInc:mainfrom
antiguru:variadic_func

Conversation

@antiguru
Copy link
Member

@antiguru antiguru commented Feb 12, 2026

Add the EagerVariadicFunc trait with a blanket LazyVariadicFunc implementation, and extend the #[sqlfunc] proc macro to generate EagerVariadicFunc implementations for variadic functions.
Convert all 30 eager variadic functions from hand-written dispatch to #[sqlfunc]-derived implementations, then extend derive_variadic! to generate the full VariadicFunc dispatch.

Best viewed commit-by-commit.

🤖 Generated with Claude Code

@github-actions
Copy link

Pre-merge checklist

  • The PR title is descriptive and will make sense in the git log.
  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).

@antiguru antiguru force-pushed the variadic_func branch 2 times, most recently from 6c22a17 to e9ed7e2 Compare February 19, 2026 13:02
@antiguru antiguru changed the title expr: refactor VariadicFunc to trait-based dispatch with typed inputs expr: extend #[sqlfunc] to variadic functions and convert all eager variadics Feb 26, 2026
@antiguru antiguru requested a review from ggevay February 26, 2026 20:30
@antiguru antiguru marked this pull request as ready for review February 26, 2026 20:30
@antiguru antiguru requested a review from a team as a code owner February 26, 2026 20:30
@antiguru antiguru requested a review from a team as a code owner February 26, 2026 22:06
@antiguru antiguru force-pushed the variadic_func branch 6 times, most recently from 078bc59 to d695205 Compare February 27, 2026 13:24
Copy link
Contributor

@ggevay ggevay left a comment

Choose a reason for hiding this comment

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

Looks good to me overall, wrote some comments.

@antiguru antiguru force-pushed the variadic_func branch 2 times, most recently from 494af7f to c7f250e Compare March 3, 2026 09:03
@antiguru antiguru requested a review from ggevay March 3, 2026 09:03
@antiguru antiguru force-pushed the variadic_func branch 3 times, most recently from 9a3710d to ebd0c52 Compare March 3, 2026 14:10
Copy link
Contributor

@ggevay ggevay left a comment

Choose a reason for hiding this comment

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

LGTM, I have just one minor comment left for list_slice_linear.

antiguru and others added 5 commits March 5, 2026 16:21
…functions

Add the `EagerVariadicFunc` trait and a blanket `LazyVariadicFunc`
implementation that bridges eager evaluation with the existing lazy
dispatch. Extend the `#[sqlfunc]` proc macro to generate
`EagerVariadicFunc` implementations for variadic functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
antiguru and others added 26 commits March 5, 2026 16:21
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
…to #[sqlfunc]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
Extend `derive_variadic!` to generate the full `impl VariadicFunc`
block (eval, output_type, propagates_nulls, introduces_nulls,
could_error, is_monotone, is_associative, is_infix_op) by delegating
to `LazyVariadicFunc` trait methods. Remove the hand-written dispatch
that duplicated per-variant logic. Convert `RangeCreate` to
`EagerVariadicFunc`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antiguru
Copy link
Member Author

antiguru commented Mar 5, 2026

Thanks! I must have attributed your comment to the wrong source location, you're correct! I updated the list_slice_linear function.

@antiguru antiguru merged commit 9c1e276 into MaterializeInc:main Mar 5, 2026
126 checks passed
@antiguru antiguru deleted the variadic_func branch March 5, 2026 15:52
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