Skip to content

Commit

Permalink
cassandra_tests: translate tests covering the vector type.
Browse files Browse the repository at this point in the history
Added cql_vector_test which tests the basic functionalities of the vector type using CQL.
Added vectors_test which tests if descending ordering of vector is supported.
  • Loading branch information
janpiotrlakomy authored and QuerthDP committed Dec 19, 2024
1 parent 0424a3e commit 83604d7
Show file tree
Hide file tree
Showing 2 changed files with 494 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/cqlpy/cassandra_tests/validation/entities/vectors_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was translated from the original Java test from the Apache
# Cassandra source repository, as of commit 54e46880690bd5effb31116986292c1bdc9e891e
#
# The original Apache Cassandra license:
#
# SPDX-License-Identifier: Apache-2.0

from ...porting import *


def testDescendingOrderingOfVectorIsSupported(cql, test_keyspace):
with create_table(cql, test_keyspace, "(k int, v vector<int, 3>, PRIMARY KEY (k, v)) WITH CLUSTERING ORDER BY (v DESC)") as table:
execute(cql, table, "INSERT INTO %s(k, v) VALUES (1, [1,2,3])")

for _ in before_and_after_flush(cql, table):
assert_rows(execute(cql, table, "SELECT v FROM %s WHERE k = 1 and v = [1,2,3]"), [[1, 2, 3]])
Loading

0 comments on commit 83604d7

Please sign in to comment.