Update Clauses

Syntax

update_clause ::=
   (SET set_clause ("," (update_clause | set_clause))*) |
   (ADD add_clause ("," (update_clause | add_clause))*) |
   (PUT put_clause ("," (update_clause | put_clause))*) |
   (REMOVE remove_clause ("," remove_clause)*) |
   (SET TTL ttl_clause ("," update_clause)*)

Semantics

There are 5 kinds of update clauses:
SET

Updates the value of one or more existing fields. See SET Clause.

ADD

Adds new elements in one or more arrays. See ADD Clause.

PUT

Adds new fields in one or more maps. It may also update the values of existing map fields. See PUT Clause.

REMOVE

Removes elements/fields from one or more arrays/maps. See REMOVE Clause.

SET TTL

Updates the expiration time of the row. See SET TTL Clause.

The update clauses are applied immediately, in the order they appear in the update statement, so the effects of each clause are visible to subsequent clauses. Although the syntax allows for multiple SET TTL clauses, only the last one will be effective; the earlier ones, if any, are ignored.

The SET, ADD, PUT, and REMOVE clauses start with a target expression, which computes the items to be updated or removed. In all cases, the target expression must be either a top-level column reference of a path expression starting with the table alias. If the target expression returns nothing, the update clause is a no-op.