Skip to content

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

Open
antiguru wants to merge 33 commits intoMaterializeInc:mainfrom
antiguru:variadic_func
Open

expr: extend #[sqlfunc] to variadic functions and convert all eager variadics#34985
antiguru wants to merge 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 4 times, most recently from 5013ece to 7553d9a Compare February 27, 2026 12:16
antiguru and others added 15 commits February 27, 2026 13:57
…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>
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>
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>
antiguru and others added 16 commits February 27, 2026 13:57
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>
antiguru and others added 2 commits February 27, 2026 14:12
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>
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.

1 participant