mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 19:21:01 +00:00
processes_selection() checks whether a selector passes-through a column or applies some form of processing (like a case or function application). It's more sensible to do this in the prepared domain as we have more information about the expression. It doesn't really help here, but it does help the refactoring later in the series.
61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#include "selector.hh"
|
|
#include "raw_selector.hh"
|
|
#include "cql3/column_identifier.hh"
|
|
#include "cql3/expr/expr-utils.hh"
|
|
|
|
namespace cql3 {
|
|
|
|
namespace selection {
|
|
|
|
lw_shared_ptr<column_specification>
|
|
selector::factory::get_column_specification(const schema& schema) const {
|
|
return make_lw_shared<column_specification>(schema.ks_name(),
|
|
schema.cf_name(),
|
|
::make_shared<column_identifier>(column_name(), true),
|
|
get_return_type());
|
|
}
|
|
|
|
bool selector::requires_thread() const { return false; }
|
|
|
|
std::vector<prepared_selector>
|
|
raw_selector::to_prepared_selectors(const std::vector<::shared_ptr<raw_selector>>& raws,
|
|
const schema& schema, data_dictionary::database db, const sstring& ks) {
|
|
std::vector<prepared_selector> r;
|
|
r.reserve(raws.size());
|
|
for (auto&& raw : raws) {
|
|
r.emplace_back(prepared_selector{
|
|
.expr = expr::prepare_expression(raw->selectable_, db, ks, &schema, nullptr),
|
|
.alias = raw->alias,
|
|
});
|
|
}
|
|
return r;
|
|
}
|
|
|
|
std::vector<shared_ptr<selectable>>
|
|
to_selectables(std::span<const prepared_selector> selectors,
|
|
const schema& schema, data_dictionary::database db, const sstring& ks) {
|
|
std::vector<::shared_ptr<selectable>> r;
|
|
r.reserve(selectors.size());
|
|
for (auto&& ps : selectors) {
|
|
r.emplace_back(prepare_selectable(schema, ps.expr, db, ks));
|
|
}
|
|
return r;
|
|
}
|
|
|
|
bool
|
|
processes_selection(const prepared_selector& ps) {
|
|
return selectable_processes_selection(ps.expr);
|
|
}
|
|
|
|
}
|
|
|
|
}
|