From d073a4c1fa8ad9d61decc6164929cc99bc3c814f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=81akomy?= Date: Sun, 1 Jun 2025 12:10:53 +0200 Subject: [PATCH] cql3/raw: add ANN ordering to the raw statement layer Extend `orderings_type` to include ANN ordering. Co-authored-by: Dawid Pawlik --- cql3/statements/raw/select_statement.hh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cql3/statements/raw/select_statement.hh b/cql3/statements/raw/select_statement.hh index da67dbaaa0..e81a3ff890 100644 --- a/cql3/statements/raw/select_statement.hh +++ b/cql3/statements/raw/select_statement.hh @@ -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; class parameters final { public: - using orderings_type = std::vector, ordering>>; + using orderings_type = std::vector, 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; using result_row_type = std::vector; + using prepared_ann_ordering_type = std::pair; using ordering_comparator_type = compare_fn; protected: virtual audit::statement_category category() const override; private: - using prepared_orderings_type = std::vector>; + using prepared_orderings_type = std::vector>; private: lw_shared_ptr _parameters; std::vector<::shared_ptr> _select_clause;