Files
floci/src/main/java
TATSUNO “Taz” Yasuhiro 82a3c1dbac feat(dynamodb): improve PartiQL grammar coverage (#3798)
* feat(dynamodb): improve PartiQL grammar coverage

An attribute reference is now a path, so a.b and a[0] work in SELECT columns,
WHERE conditions and UPDATE SET and REMOVE targets. SELECT reports a path from
its last named component on, so SELECT a.b[0] answers b[0].

Values take map, list and set literals, exponent numbers and a doubled single
quote. An empty set, a mixed set and a set with a repeated member are refused
in the AWS words.

WHERE takes OR, NOT, parentheses, IN with a list literal, IS MISSING and IS
NULL with their negations, and the contains, attribute_type and size
functions. Each becomes the matching filter or condition expression, so the
existing evaluator does the work.

UPDATE SET takes a sum or difference, list_append, set_add and set_delete. A
predicate beside the key equality becomes a condition on the write, so a false
one answers ConditionalCheckFailedException and leaves the item. UPDATE is not
an upsert and needs the key to hold an item already, while a DELETE on a key
holding no item stays a no-op. A clause omitting a key attribute says so.

RETURNING runs all four variants on UPDATE and ALL OLD * on DELETE. It answers
one row on Items, and no row when the projection is empty. DELETE refuses the
other three and ExecuteTransaction refuses the clause outright.

SELECT takes ORDER BY on the key, pages the sorted rows, and refuses the shapes
AWS refuses. A FROM path takes at most two components and no empty one. INSERT
refuses an index qualifier as a parse error, UPDATE and DELETE refuse the
operation on an index, and a keyed read filtering on an attribute the index
does not project is refused.

ExecuteTransaction runs a transaction of nothing but SELECT as a read, runs
EXISTS as a condition check, refuses a mix of reads and writes, and no longer
applies twice on a replayed ClientRequestToken. A BatchExecuteStatement member
carries the short error code and echoes TableName when it reached its table.

Two update engine bugs came out of this and are fixed for UpdateItem as well.
list_append on a nested path wrote a new top-level attribute, and ADD or DELETE
with an operand of another type replaced or ignored the stored value.

* fix(dynamodb): read key equalities inside a grouped AND in PartiQL

* fix(dynamodb): subtract without spaces and refuse trailing tokens in PartiQL

* fix(dynamodb): refuse a negative list index in PartiQL

* fix(dynamodb): refuse a non-string type in PartiQL attribute_type

* fix(dynamodb): refuse a value that is not a set in PartiQL set_add and set_delete

* fix(dynamodb): refuse duplicate members in a PartiQL bag

* fix(dynamodb): check PartiQL parameters before reading the statement

* fix(dynamodb): refuse two PartiQL reads of one item in a transaction

* fix(dynamodb): read only by the key in a PartiQL transaction SELECT

* fix(dynamodb): check unprojected attributes inside grouped PartiQL conditions

* fix(dynamodb): refuse an ADD or DELETE operand type before reading the item

* fix(dynamodb): skip line and block comments in PartiQL

* fix(dynamodb): apply a sign to a PartiQL number literal

* fix(dynamodb): refuse a parameter inside a PartiQL collection literal

* test(dynamodb): read a parameter in IN on a non-key attribute

* fix(dynamodb): refuse a PartiQL list index above the integer range

* fix(dynamodb): refuse a PartiQL literal nested 32 levels deep

* fix(dynamodb): refuse a non-number literal in PartiQL arithmetic

* feat(dynamodb): read attribute_exists and attribute_not_exists in PartiQL

* feat(dynamodb): compare a PartiQL condition with a boolean

* fix(dynamodb): match nothing when ordering a value against another type

* fix(dynamodb): read PartiQL key conditions spread over OR and IN like AWS

* fix(dynamodb): read a PartiQL transaction or batch SELECT only by its key

* fix(dynamodb): refuse two values for one key on a PartiQL write

* fix(dynamodb): cancel a PartiQL transaction that names a missing table

* fix(dynamodb): cancel a PartiQL transaction whose statement does not name one item

* fix(dynamodb): refuse a write that leaves an item nested too deep

* fix(dynamodb): refuse a PartiQL parameter only past the nesting limit AWS uses

* chore(dynamodb): drop comments that restate the code or a test

* perf(dynamodb): work out each PartiQL key branch once and cap how far it spreads

* chore(dynamodb): share one first key value helper across PartiQL key checks

* chore(dynamodb): throw the ADD or DELETE operand error and merge member loops

* chore(dynamodb): track PartiQL literal depth in one place and share truth helpers

* test(dynamodb): name the quoted table once and add statement and putItem overloads

* fix(dynamodb): cap IN operands and decomposed reads in PartiQL
2026-09-18 21:04:16 -05:00
..