Files
scylladb/cql3/expr
Nadav Har'El 35e807a36c cql3: prepare and evaluate WRITETIME/TTL on collection elements and UDT fields
Complete the implementation of SELECT WRITETIME(col[key])/TTL(col[key])
and WRITETIME(col.field)/TTL(col.field), building on the grammar (commit 1),
wire format (commit 2), and selection-layer (commit 3) changes in the
preceding patches.

* prepare_column_mutation_attribute() (prepare_expr.cc) now handles the
  subscript and field_selection nodes that the grammar produces:
  - For subscripts, it validates that the inner column is a non-frozen
    map or set and checks the 'writetime_ttl_individual_element' feature
    flag so the feature is rejected during rolling upgrades.
  - For field selections, it validates that the inner column is a
    non-frozen UDT, with the same feature-flag check.

* do_evaluate(column_mutation_attribute) (expression.cc) handles the
  same two cases. For a field selection it serializes the field index as
  a key and looks it up in collection_element_metadata; for a subscript
  it evaluates the subscript key and looks it up in the same map.
  A missing key (element not found or expired) returns NULL, matching
  Cassandra behavior.

Together with the preceding three patches, this finally fixes #15427.

The next three patches will add tests and documentation for the new
feature, and the final eighth patch will fix the implementation of
UDT fields in LWT expressions - which the first patch made the grammar
allow but is still not implemented correctly.
2026-04-12 13:28:28 +03:00
..