Remove per-query generation of built-in record type constructors#2603
Merged
ChristianGruen merged 3 commits intoBaseXdb:mainfrom Feb 18, 2026
Merged
Conversation
… parameters; revert incorrect change of fn:divided-decimals-record
Member
|
Thanks, looks fine.
I agree this sounds promising. |
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 PR removes the per-query generation of built-in record type constructors in
QueryParser. Instead, constructors for built-in record types are now registered once as standard functions via theFunctionenum.The constructor signatures and parameter types are still derived from the
Recordsenum (i.e.,RecordTyperemains the single source of truth). A newFunction(RecordType)constructor and corresponding helper methods inRecordTypeare used to generate:name(a,b[,c])), andAt runtime, the constructor implementation creates either:
XQRecordMap(for record types without optional fields), orXQMap(if optional fields are present).This change eliminates the repeated initialization overhead per query execution while preserving existing semantics.
There is now some similarity between
RecordType.constructor()andCRecord. I did not reuseCRecord, as theFunctioninfrastructure requires aStandardFunc. However,CRecordcould potentially be refactored to build uponRecordType.constructor(). I’m submitting this early as I’ll be unavailable for the next few days, but I’m happy to follow up on theCRecordrefactoring afterwards.