Files
scylladb/cql3/expr/evaluate.hh
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

40 lines
1.3 KiB
C++

// Copyright (C) 2023-present ScyllaDB
// SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
#pragma once
#include "expression.hh"
#include "bytes.hh"
namespace cql3 {
class query_options;
class raw_value;
}
namespace cql3::expr {
// Input data needed to evaluate an expression. Individual members can be
// null if not applicable (e.g. evaluating outside a row context)
struct evaluation_inputs {
std::span<const bytes> partition_key;
std::span<const bytes> clustering_key;
std::span<const managed_bytes_opt> static_and_regular_columns; // indexes match `selection` member
const cql3::selection::selection* selection = nullptr;
const query_options* options = nullptr;
std::span<const api::timestamp_type> static_and_regular_timestamps; // indexes match `selection` member
std::span<const int32_t> static_and_regular_ttls; // indexes match `selection` member
std::span<const cql3::raw_value> temporaries; // indexes match temporary::index
};
// Takes a prepared expression and calculates its value.
// Evaluates bound values, calls functions and returns just the bytes and type.
cql3::raw_value evaluate(const expression& e, const evaluation_inputs&);
cql3::raw_value evaluate(const expression& e, const query_options&);
}