Repository navigation
Improve function encapsulation API - #4397
Merged
Merged
Conversation
normen662
requested changes
Jul 27, 2026
normen662
left a comment
Contributor
There was a problem hiding this comment.
I think I am okay with the general approach being taken. A bunch of little things, but I think you said this is not ready yet anyway?
normen662
reviewed
Jul 27, 2026
hatyo
marked this pull request as ready for review
July 28, 2026 17:03
normen662
approved these changes
Jul 30, 2026
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.
This reworks function encapsulation so that a function receives the call site it was invoked from, rather than just a bag of arguments.
CatalogedFunction's twoencapsulateoverloads, one positional, one named, collapse into a singleencapsulate(CallSiteArguments), whereCallSiteArgumentsis a sealed type that knows which calling convention was used and carries the window specification and any call-site options alongside the arguments themselves. Functions that only ever supported one convention no longer have to implement a second method just to throw from it, andUserDefinedMacroFunction, the one implementor that genuinely handles both, now branches onisNamed()in a single place.Options are the substantive part of the change. A function declares the options it understands through
getSupportedOptions(), using typedOptionkeys held as constants next to the function, andBuiltInFunction.encapsulatefunnels every built-in throughvalidateAndNormalizeOptionsso an option the function doesn't declare is rejected with a proper error instead of being silently dropped, and a recognized one arrives already converted to its declared type. Options are deliberately not a global namespace: they're resolved only against the declared set of the function actually being called, so two unrelated functions may reuse a name without colliding. With the window specification and options both first-class,row_numberno longer needs the partition and ordering columns smuggled in as two synthetic array constructors, andRowNumberFnreadsef_searchandreturn_vectorsdirectly from the call site.That in turn lets the higher-order machinery go away.
RowNumberHighOrderValuewas only ever a carrier for the curried configuration, so it and the arity-retry fallback inSemanticAnalyzerare both removed, andPValuefield58is reserved.This fixes #4406.