feat: add support for arrays with sequences as members#1416
Open
feat: add support for arrays with sequences as members#1416
Conversation
…ces in Item interface and implement them in ArrayItem and SequenceArrayItem classes
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
…n calls on arrays and enhance type checking
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
…ch conditional logic to fast path
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
Test Results (qt3tests)RumbleDB, XQuery parser
RumbleDB, JSONiq parser
|
b3ff173 to
54c6314
Compare
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.
Overview
This branch targets XQuery 3.1 / F&O 3.1 array semantics in Rumble: each array member is a logical sequence of items (length 1 for typical cells, or longer when the source expression produces multiple items for that member). It adds
SequenceArrayItem, extends theItemAPI for per-member sequences, wires construction and navigation through the compiler and runtime, registers a largearray:function surface inBuiltinFunctionCatalogue, and implements those functions as dedicated iterators. It also adds v0 XQuery support for array tests and item tests in the translation pipeline, plusArrayFunctionCallIteratorso function items can be invoked in array contexts with appropriate typing checks.On
Item, array values expose member sequences viagetSequences()(all members) andgetSequenceAt(int)(zero-based, parallel togetItemAt).allowsNonSingletons()distinguishes representations that may store multi-item members from singleton-only arrays, so hot paths can avoid unnecessary sequence handling.ArrayRuntimeIteratorbuilds arrays from member sequences (e.g.createArrayFromMemberSequencesonItemFactory), and array lookup, unboxing, members, and descendant code paths are updated so sequence members behave consistently end-to-end.array:sortis implemented withSortKeyComparisonso ordering aligns with the engine’s comparison/sort-key rules for the supported sort signatures.Changelog
1. Array members as sequences (data model and API)
SequenceArrayItemand implement sequence-aware behavior alongsideArrayItem.Item:getSequences(),getSequenceAt(int), andallowsNonSingletons()for array items; refactor of older “member sequence” accessors toward thisgetSequence*naming (see commitf76efc7b9).ItemFactory: support for creating arrays from lists of member sequences and related factory paths used by runtime construction.2. Wiring construction, types, and visitors
ArrayConstructorExpressionand runtime array construction updated so each member can materialize to a sequence, not only a single item.XQueryTranslationVisitor,InferTypeVisitor,RuntimeIteratorVisitor,CloneVisitor,ComparisonVisitor, and shared visitors such asAbstractNodeVisitor—so array typing, cloning, and execution stay consistent with sequence members.ArrayItemType(and related typing) updated so static knowledge of arrays can reflect non-singleton members where the type system models that.3. Runtime navigation and closures
members, and descendant iterators and closures updated to use member sequences (getSequences/ per-member lists) instead of assuming one item per slot everywhere.4.
array:*functions (F&O-oriented iterators)Registered and implemented (exact arity/overloads per
BuiltinFunctionCatalogueand iterator classes underruntime/functions/arrays/), including:array:size,array:get,array:head,array:tail,array:subarray,array:insert-before,array:remove,array:reverse,array:append,array:join,array:flatten.array:fold-left,array:fold-right,array:for-each,array:for-each-pair,array:filter,array:sort(including variants with collation / key function where implemented).5. Dynamic calls on arrays
ArrayFunctionCallIterator: invoke function items in array contexts with the extra type checking and runtime behavior described in commitf5ca3360b.6. XQuery surface
7e7b1ea87) and item tests (commitaa3a19305) in the XQuery translation stack.