cql3/raw: add ANN ordering to the raw statement layer

Extend `orderings_type` to include ANN ordering.

Co-authored-by: Dawid Pawlik <dawid.pawlik@scylladb.com>
This commit is contained in:
Jan Łakomy
2025-06-01 12:10:53 +02:00
committed by Dawid Pawlik
parent 8d5249420b
commit d073a4c1fa

View File

@@ -43,9 +43,13 @@ public:
ascending,
descending
};
// Vector of floats with dimension the same as the vector indexed column.
// This vector is the target for the nearest neighbors in ANN queries.
using ann_vector = expr::expression;
using ordering_type = std::variant<ordering, ann_vector>;
class parameters final {
public:
using orderings_type = std::vector<std::pair<shared_ptr<column_identifier::raw>, ordering>>;
using orderings_type = std::vector<std::pair<shared_ptr<column_identifier::raw>, ordering_type>>;
enum class statement_subtype { REGULAR, JSON, PRUNE_MATERIALIZED_VIEW, MUTATION_FRAGMENTS };
private:
const orderings_type _orderings;
@@ -75,11 +79,12 @@ public:
using compare_fn = std::function<bool(const T&, const T&)>;
using result_row_type = std::vector<managed_bytes_opt>;
using prepared_ann_ordering_type = std::pair<const column_definition*, expr::expression>;
using ordering_comparator_type = compare_fn<result_row_type>;
protected:
virtual audit::statement_category category() const override;
private:
using prepared_orderings_type = std::vector<std::pair<const column_definition*, ordering>>;
using prepared_orderings_type = std::vector<std::pair<const column_definition*, ordering_type>>;
private:
lw_shared_ptr<const parameters> _parameters;
std::vector<::shared_ptr<selection::raw_selector>> _select_clause;