Skip to content

Add collection transformation and sequence value expressions - #10

Merged
chedim merged 1 commit into
masterfrom
feature/sequence-and-collection-transform-exprs
Aug 10, 2026
Merged

Add collection transformation and sequence value expressions#10
chedim merged 1 commit into
masterfrom
feature/sequence-and-collection-transform-exprs

Conversation

@SanjanaBoggaramJ

Copy link
Copy Markdown
Collaborator

Summary

  • Adds ARRAY/FIRST/OBJECT ... FOR ... END as general expressions, reusing the existing range_expr FOR-binding grammar. Previously ARRAY only worked inside index definitions.
  • full_array_expr (used by index_key) now delegates to the new array_transform_expr instead of duplicating it.
  • Adds NEXT VALUE FOR / NEXTVAL FOR / PREVIOUS VALUE FOR / PREV VALUE FOR / PREVVAL FOR sequence value expressions.
  • Combined in one PR since both add an alternative to the same expr rule.

Solves the Sequence value and collection transformation issue mentioned in #6

For more info here are the respective doc links:

Test plan

  • Added tests for ARRAY/FIRST/OBJECT transforms, the CREATE INDEX regression path, and all 5 sequence-expr synonyms.
  • Confirmed CollectionExtractor doesn't misinterpret the new var/name_var bindings as keyspace paths.
  • Full existing test suite passes with no regressions.
  • Found two pre-existing, unrelated RETURNING bugs — filed separately.

Adds ARRAY/FIRST/OBJECT ... FOR ... END as general expressions
(collection_transform_expr), reusing the existing range_expr FOR
binding grammar. full_array_expr (used by index_key) now delegates
to array_transform_expr instead of duplicating its body.

Adds NEXT VALUE FOR / NEXTVAL FOR / PREVIOUS VALUE FOR / PREV VALUE
FOR / PREVVAL FOR sequence value expressions per the N1QL sequence
ops docs, reusing the existing `sequence` reference rule.

Both features add a new expr alternative, so they're combined in one
branch/PR to avoid a two-PR merge conflict on the same grammar rule.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope.

Comment thread src/lark_sqlpp/sqlpp.lark
Comment thread tests/test_parser.py
@chedim
chedim merged commit 65d23f4 into master Aug 10, 2026
1 check passed
@chedim
chedim deleted the feature/sequence-and-collection-transform-exprs branch August 10, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants