Repository navigation
expr: Return specific output types instead of Datum - #39105
Merged
Merged
Conversation
antiguru
added this pull request to stack #38942
September 24, 2026 10:15
antiguru
force-pushed
the
sqlfunc-specific-output-types
branch
from
September 24, 2026 14:29
72d9f56 to
70281de
Compare
antiguru
force-pushed
the
sqlfunc-specific-output-types
branch
from
September 25, 2026 16:00
70281de to
4941c1e
Compare
antiguru
force-pushed
the
sqlfunc-specific-output-types
branch
from
October 14, 2026 09:11
4941c1e to
f499b3c
Compare
antiguru
force-pushed
the
sqlfunc-specific-output-types
branch
from
October 14, 2026 15:18
f499b3c to
9cf6009
Compare
antiguru
removed this pull request from stack #38942
October 14, 2026 15:45
antiguru
changed the base branch from
sqlfunc-convert-string
to
sqlfunc-convert-int16
October 14, 2026 15:45
antiguru
force-pushed
the
sqlfunc-specific-output-types
branch
from
October 14, 2026 15:46
9cf6009 to
7c97bf1
Compare
antiguru
added this pull request to stack #39823
October 14, 2026 15:46
Fifteen `#[sqlfunc]` functions returned a bare `Datum` although each always produces an array, a list, a map or a JSON value. `Datum`'s `OutputDatumType` reports nullable, so every one of them carried an explicit `introduces_nulls` to restate what the body already guaranteed. Returning `Array<'a>`, `DatumList<'a>`, `DatumMap<'a>`, or an `Option` of one, lets the macro derive that value instead. `array_create`, `array_fill`, `array_remove`, `string_to_array` and both arities of `regexp_split_to_array` return `Array<'a>`. `list_create`, `record_create`, `list_slice_linear` and `timezone_offset` return `DatumList<'a>`, and `map_build` returns `DatumMap<'a>`. Each drops `introduces_nulls = false`. Both arities of `regexp_match` return `Option<Array<'a>>`, since a failed match is NULL, and `jsonb_delete_int64` and `jsonb_delete_string` return `Option<JsonbRef<'a>>`, since deleting from a JSON scalar is NULL. `JsonbRef` has a column type, so the two `jsonb_delete` functions also drop their `output_type_expr`. The shared helpers `array_create_scalar`, `array_create_multidim`, `regexp_match_static`, `regexp_split_to_array_re` and `string_to_array_impl` return the typed value too, so the conversion happens where the datum is packed. `regexp_match_static` takes the haystack as `&str`, which lets the unary `regexp_match` take `&'a str` in place of `ExcludeNull<Datum<'a>>`. The registry reports only `sqlfunc_signature` moving, on all fifteen records. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
antiguru
force-pushed
the
sqlfunc-specific-output-types
branch
from
October 14, 2026 19:12
7c97bf1 to
a3cfb05
Compare
antiguru
added a commit
that referenced
this pull request
Oct 14, 2026
…d_from_record_list (#39814) Two functions declared properties more conservatively than their bodies need, inherited from hand-written impls and kept by their conversion to `#[sqlfunc]` in #39062. This drops the pins and lets the macro derive the properties from the output type. * `record_get` returns a field of its input record and never produces an `EvalError`, but it declared `could_error = true`, the `LazyUnaryFunc` default. It now derives `false` from the non-`Result` output. * `map_build_from_record_list` skips NULL records and keys and always returns a map, but it declared `introduces_nulls` and `could_error` true and a nullable output. Both flags now derive `false` from the `DatumMap` output, and the output type is non-nullable. The registry reports exactly these moves. The current `LIR_VERSION` hasn't shipped, so the snapshots are regenerated in place. The sqllogictest files that mention `record_get` show no plan changes, and the sqllogictest shards passed on an earlier version of the stack that carried the `map_build_from_record_list` change. Based on #39105. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fifteen
#[sqlfunc]functions returned a bareDatumalthough each always produces an array, a list, a map or a JSON value. Each therefore restated its nullability withintroduces_nulls. They now returnArray<'a>,DatumList<'a>orDatumMap<'a>, or anOptionof one where the function can return NULL, and the macro derives the value. The shared helpers return the typed values too, and the twojsonb_deletefunctions drop theiroutput_type_expr.The registry reports only
sqlfunc_signaturemoving, on all fifteen records.Based on #39062.
🤖 Generated with Claude Code