mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-22 15:52:13 +00:00
Wire up the selection and result-set infrastructure to consume the extended collection wire format introduced in the previous patch and expose per-element timestamps and TTLs to the expression evaluator. * Add collection_cell_metadata: maps from raw element-key bytes to timestamp and remaining TTL, one entry per collection or UDT cell. Add a corresponding collection_element_metadata span to evaluation_inputs so that evaluators can access it. * Add a flag _collect_collection_timestamps to selection (selection.hh/cc). When any selected expression contains a WRITETIME(col[key])/TTL(col[key]) or WRITETIME(col.field)/TTL(col.field) attribute, the flag is set and the send_collection_timestamps partition-slice option is enabled, causing storage nodes to use the extended wire format from the previous patch. * Implement result_set_builder::add_collection() (selection.cc): when _collect_collection_timestamps is set, parse the extended format, decode per-element timestamps and remaining TTLs (computed from the stored expiry time and the query time), and store them in _collection_element_metadata indexed by column position. When the flag is not set, the existing plain-bytes path is unchanged. After this patch, the new selection feature is still not available to the end-user because the prepare step still forbids it. The next patch will finally complete the expression preparation and evaluation. It will read the new collection_element_metadata and return the correct timestamp or TTL value.
22 lines
627 B
C++
22 lines
627 B
C++
// Copyright (C) 2026-present ScyllaDB
|
|
// SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
|
|
#include "bytes.hh"
|
|
#include "mutation/timestamp.hh"
|
|
|
|
namespace cql3::expr {
|
|
|
|
// Per-element timestamps and TTLs for a cell of a map, set or UDT (populated
|
|
// when a WRITETIME() or TTL() of col[key] or col.field are in the query.
|
|
// Keys are the raw serialized keys or serialized field index.
|
|
struct collection_cell_metadata {
|
|
std::map<bytes, api::timestamp_type> timestamps;
|
|
std::map<bytes, int32_t> ttls; // remaining TTL in seconds (-1 if no TTL)
|
|
};
|
|
|
|
} // namespace cql3::expr
|