This is an automated email from the ASF dual-hosted git repository.

adelapena pushed a commit to branch cassandra-5.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-5.0 by this push:
     new f41ecf586c Upgrade Python driver to 3.28.0
f41ecf586c is described below

commit f41ecf586c0459476d68e755c6431119f08ff4e1
Author: Andrés de la Peña <[email protected]>
AuthorDate: Thu Nov 2 13:59:58 2023 +0000

    Upgrade Python driver to 3.28.0
    
    patch by Andrés de la Peña and Jeremiah Jordan; reviewed by Brandon 
Williams for CASSANDRA-18960
    
    Co-authored-by: Jeremiah Jordan <[email protected]>
    Co-authored-by: Andrés de la Peña <[email protected]>
---
 CHANGES.txt                                   |   1 +
 lib/cassandra-driver-internal-only-3.25.0.zip | Bin 345177 -> 0 bytes
 lib/cassandra-driver-internal-only-3.28.0.zip | Bin 0 -> 356837 bytes
 pylib/cqlshlib/formatting.py                  |  15 +++++++++++----
 pylib/cqlshlib/test/test_cqlsh_output.py      |  22 ++++++++++++++++++++++
 5 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index f288f3206e..f54569f342 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 5.0-alpha2
+ * 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)
diff --git a/lib/cassandra-driver-internal-only-3.25.0.zip 
b/lib/cassandra-driver-internal-only-3.25.0.zip
deleted file mode 100644
index ecfd6a946e..0000000000
Binary files a/lib/cassandra-driver-internal-only-3.25.0.zip and /dev/null 
differ
diff --git a/lib/cassandra-driver-internal-only-3.28.0.zip 
b/lib/cassandra-driver-internal-only-3.28.0.zip
new file mode 100644
index 0000000000..07e0379447
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.28.0.zip 
differ
diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py
index 4eb36581c6..23bf1efbbf 100644
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@ -149,8 +149,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:
@@ -167,8 +167,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):
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py 
b/pylib/cqlshlib/test/test_cqlsh_output.py
index c17def624a..9ca7988d2e 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -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 = testcall_cqlsh(prompt=None, env=self.default_env,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to