mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 10:00:35 +00:00
Adding a function declaration to expression.hh causes many recompilations. Reduce that by: - moving some restrictions-related definitions to the existing expr/restrictions.hh - moving evaluation related names to a new header expr/evaluate.hh - move utilities to a new header expr/expr-utilities.hh expression.hh contains only expression definitions and the most basic and common helpers, like printing.
39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
// Copyright (C) 2023-present ScyllaDB
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include "expression.hh"
|
|
|
|
#include "bytes.hh"
|
|
#include <vector>
|
|
|
|
namespace cql3 {
|
|
|
|
class query_options;
|
|
|
|
}
|
|
|
|
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
|
|
};
|
|
|
|
// 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&);
|
|
|
|
|
|
}
|