Merge branch 'cassandra-5.0' into trunk

This commit is contained in:
Andrés de la Peña 2023-11-02 17:10:13 +00:00
commit 53c25f8faa
5 changed files with 34 additions and 4 deletions

View File

@ -3,6 +3,7 @@
* Add the ability to disable bulk loading of SSTables (CASSANDRA-18781)
* Clean up obsolete functions and simplify cql_version handling in cqlsh (CASSANDRA-18787)
Merged from 5.0:
* Upgrade Python driver to 3.28.0 (CASSANDRA-18960)
* Add retries to IR messages (CASSANDRA-18962)
* Add metrics and logging to repair retries (CASSANDRA-18952)
* Remove deprecated code in Cassandra 1.x and 2.x (CASSANDRA-18959)

Binary file not shown.

View File

@ -148,8 +148,8 @@ class CqlType:
def parse(self, typestring, ksmeta):
"""
Parse the typestring by looking at this pattern: *<*>. If there is no match then the type
is either a simple type or a user type, otherwise it must be a composite type
for which we need to look-up the sub-types. For user types the sub types can be extracted
is either a simple type or a user type, otherwise it must be a composite type or a vector type,
for which we need to look up the subtypes. For user types the subtypes can be extracted
from the keyspace metadata.
"""
while True:
@ -166,8 +166,15 @@ class CqlType:
typestring = m.group(2)
continue
name = m.group(1) # a composite type, parse sub types
return name, self.parse_sub_types(m.group(2), ksmeta), self._get_formatter(name)
name = m.group(1) # a composite or vector type, parse subtypes
try:
# Vector types are parameterized as name<type,size> so add custom handling for that here
type_args = m.group(2).split(',')
vector_type = CqlType(type_args[0])
vector_size = int(type_args[1])
return name, [vector_type for _ in range(vector_size)], self._get_formatter(name)
except (ValueError, IndexError):
return name, self.parse_sub_types(m.group(2), ksmeta), self._get_formatter(name)
@staticmethod
def _get_formatter(name):

View File

@ -935,6 +935,28 @@ class TestCqlshOutput(BaseTestCase):
"""),
))
def test_vectors_output(self):
self.assertQueriesGiveColoredOutput((
("SELECT vectorcol FROM has_all_types;", r"""
vectorcol
MMMMMMMMM
-----------------------
[1, -2, NaN]
BGBBGGBBGGGB
[1, 2, 3]
BGBBGBBGB
[0, 0, 0]
BGBBGBBGB
null
RRRR
[1e+08, 1e+08, 1e+08]
BGGGGGBBGGGGGBBGGGGGB
(5 rows)
"""),
))
def test_expanded_output_counts_past_page(self):
query = "PAGING 5; EXPAND ON; SELECT * FROM twenty_rows_table;"
output, result = cqlsh_testcall(prompt=None, env=self.default_env,