Rename scalar function strictness contract - #8930
Merged
Merged
Conversation
connortsui20
force-pushed
the
agent/rename-scalar-fn-strictness
branch
2 times, most recently
from
July 23, 2026 19:02
15f1ae9 to
60b7f57
Compare
connortsui20
marked this pull request as ready for review
July 23, 2026 19:49
joseph-isaacs
requested changes
Jul 24, 2026
joseph-isaacs
left a comment
Contributor
There was a problem hiding this comment.
good direction. just want to ensure it's all sound
Contributor
|
Can we rewrite the description to just mention strict and non-strict results. mentioning |
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
connortsui20
force-pushed
the
agent/rename-scalar-fn-strictness
branch
from
July 27, 2026 14:16
60b7f57 to
a3494a5
Compare
Comment on lines
+341
to
+343
| fn is_strict(&self, _options: &Self::Options) -> bool { | ||
| true | ||
| } |
Contributor
There was a problem hiding this comment.
this is not the default, is it?
Member
Author
There was a problem hiding this comment.
I changed the default to false on the vtable?
Contributor
There was a problem hiding this comment.
Add this file is the wrong vtable lol
connortsui20
force-pushed
the
agent/rename-scalar-fn-strictness
branch
2 times, most recently
from
July 27, 2026 15:27
1a807fc to
a3494a5
Compare
joseph-isaacs
approved these changes
Jul 27, 2026
connortsui20
enabled auto-merge (squash)
July 27, 2026 15:38
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.
Changes
is_null_sensitivetois_strictand flips all current implementations (asis_strictimplies!is_null_sensitive).A function is strict only when any null input forces a null output and its return dtype propagates that nullability.
Also fixes
BetweenandDynamicscalar functions as they were both set to strict when they should have been non-strict, so now they areis_strict = false.Rationale for this change
Dictionary pushdown rewrites
f(dict(codes, values), constant)asdict(codes, f(values, constant)). At a null code, the original evaluatesf(null, constant), while the rewritten dictionary is always null. This is only sound when nulling any one argument forces a null result while the other arguments remain unchanged.is_null_sensitivedocumented the unary case but left this multi-argument contract ambiguous. KleeneAND/ORshow the difference: masking both inputs produces null, butfalse AND null = falseandtrue OR null = true. That ambiguity caused the bug fixed in #8929.Additionally, we have noticed that a large majority of our scalar functions have strict semantics, and so in the future (hopefully soon) we can lift out a lot of the shared null logic.
What changes are included in this PR?
Functions that are strict, previously treated as non-strict
These functions are strict, so the old null-sensitivity classification was overly conservative:
ArrayExprandRowIdxinherited the old conservative default. These functions take no arguments, so the strictness condition does not apply.Maskinherited the old conservative default, but a null input remains null and its mask argument is required to be non-nullable.VariantGetinherited the old conservative default, but a null Variant input produces a null output.GetItemandSelectpreserve the parent struct validity and propagate its nullability.Mergeonly accepts non-nullable inputs, so the strictness law is vacuously satisfied for well-typed arguments.Functions that are non-strict, previously treated as strict
These functions are non-strict, so the old classification allowed unsound dictionary pushdown:
Between: its comparisons are combined with KleeneAND; for example,10 BETWEEN null AND 5isfalse, not null.DynamicComparison: when the dynamic RHS is absent, it returns its configured default even when the LHS is null.Remaining non-strict functions
Binaryfor KleeneAND/ORCaseWhenandZipCastFillNull,IsNull, andIsNotNullForeignScalarFnVTableListContainsPackRowEncodeandRowSizeStatFnRemaining strict functions
Binaryfor all operators exceptAND/ORByteLength,ExtStorage,Like,ListLength,ListSum, andNotLiteral,Root, andRowCount(nullary)JsonToVariantGeoContains,GeoDistance,GeoEnvelope, andGeoIntersectsCosineSimilarity,InnerProduct,L2Denorm, andL2Norm