You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2021/05/05 12:22:55 UTC
[cassandra] branch cassandra-4.0 updated: Revert "Fix cqlsh DESC
TYPE with non-ascii character in the identifier"
This is an automated email from the ASF dual-hosted git repository.
brandonwilliams pushed a commit to branch cassandra-4.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-4.0 by this push:
new a3db118 Revert "Fix cqlsh DESC TYPE with non-ascii character in the identifier"
a3db118 is described below
commit a3db11831a0a7dd53c69da8df93bb9c35bc43eca
Author: Brandon Williams <br...@apache.org>
AuthorDate: Wed May 5 07:21:53 2021 -0500
Revert "Fix cqlsh DESC TYPE with non-ascii character in the identifier"
This reverts commit 327d7c18033290f5494a6d10257735d80b8cbf29.
---
CHANGES.txt | 1 -
bin/cqlsh.py | 18 +++++++-------
pylib/cqlshlib/copyutil.py | 2 +-
pylib/cqlshlib/test/test_cqlsh_completion.py | 5 +++-
pylib/cqlshlib/test/test_unicode.py | 35 +---------------------------
5 files changed, 16 insertions(+), 45 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index f2b0d3d..2693388 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,4 @@
4.0-rc2
- * Fix cqlsh DESC TYPE with non-ascii character in the identifier (CASSANDRA-16400)
* Fix cqlsh encoding error with unicode in multi-line statement (CASSANDRA-16539)
* Fix race in fat client removal (CASSANDRA-16238)
* Test org.apache.cassandra.net.AsyncPromiseTest FAILED (CASSANDRA-16596)
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 102a416..f964fc9 100755
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -622,37 +622,37 @@ class Shell(cmd.Cmd):
self.connection_versions = vers
def get_keyspace_names(self):
- return list(self.conn.metadata.keyspaces)
+ return list(map(str, list(self.conn.metadata.keyspaces.keys())))
def get_columnfamily_names(self, ksname=None):
if ksname is None:
ksname = self.current_keyspace
- return list(self.get_keyspace_meta(ksname).tables)
+ return list(map(str, list(self.get_keyspace_meta(ksname).tables.keys())))
def get_materialized_view_names(self, ksname=None):
if ksname is None:
ksname = self.current_keyspace
- return list(self.get_keyspace_meta(ksname).views)
+ return list(map(str, list(self.get_keyspace_meta(ksname).views.keys())))
def get_index_names(self, ksname=None):
if ksname is None:
ksname = self.current_keyspace
- return list(self.get_keyspace_meta(ksname).indexes)
+ return list(map(str, list(self.get_keyspace_meta(ksname).indexes.keys())))
def get_column_names(self, ksname, cfname):
if ksname is None:
ksname = self.current_keyspace
layout = self.get_table_meta(ksname, cfname)
- return list(layout.columns)
+ return [str(col) for col in layout.columns]
def get_usertype_names(self, ksname=None):
if ksname is None:
ksname = self.current_keyspace
- return list(self.get_keyspace_meta(ksname).user_types)
+ return list(self.get_keyspace_meta(ksname).user_types.keys())
def get_usertype_layout(self, ksname, typename):
if ksname is None:
@@ -1404,7 +1404,9 @@ class Shell(cmd.Cmd):
"""
Print the output for a DESCRIBE KEYSPACES query
"""
- names = [ensure_str(r['name']) for r in rows]
+ names = list()
+ for row in rows:
+ names.append(str(row['name']))
print('')
cmd.Cmd.columnize(self, names)
@@ -1424,7 +1426,7 @@ class Shell(cmd.Cmd):
keyspace = row['keyspace_name']
names = list()
- names.append(ensure_str(row['name']))
+ names.append(str(row['name']))
if keyspace is not None:
self.print_keyspace_element_names(keyspace, names)
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index d22bf8b..1056c52 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -560,7 +560,7 @@ class ExportWriter(object):
if self.header:
writer = csv.writer(self.current_dest.output, **self.options.dialect)
- writer.writerow([ensure_str(c) for c in self.columns])
+ writer.writerow(self.columns)
return True
diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py
index c898cbe..8b296b8 100644
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@ -696,7 +696,10 @@ class TestCqlshCompletion(CqlshCompletionCase):
self.trycompletions('CREATE TA', immediate='BLE ')
self.create_columnfamily_table_template('TABLE')
- def test_complete_in_describe(self): # Cassandra-10733
+ def test_complete_in_describe(self):
+ """
+ Tests for Cassandra-10733
+ """
self.trycompletions('DES', immediate='C')
# quoted_keyspace = '"' + self.cqlsh.keyspace + '"'
self.trycompletions('DESCR', immediate='IBE ')
diff --git a/pylib/cqlshlib/test/test_unicode.py b/pylib/cqlshlib/test/test_unicode.py
index 869cdb3..b31e81c 100644
--- a/pylib/cqlshlib/test/test_unicode.py
+++ b/pylib/cqlshlib/test/test_unicode.py
@@ -56,43 +56,10 @@ class TestCqlshUnicode(BaseTestCase):
output = c.cmd_and_response('SELECT * FROM t;')
self.assertIn(col_name, output)
- def test_unicode_multiline_input(self): # CASSANDRA-16400
+ def test_multiline_input(self): # CASSANDRA-16539
with testrun_cqlsh(tty=True, env=self.default_env) as c:
value = '値'
c.send("INSERT INTO t(k, v) VALUES (1, \n'%s');\n" % (value,))
c.read_to_next_prompt()
output = c.cmd_and_response('SELECT v FROM t;')
self.assertIn(value, output)
-
- def test_unicode_desc(self): # CASSANDRA-16539
- with testrun_cqlsh(tty=True, env=self.default_env) as c:
- v1 = 'ࠑ'
- v2 = 'Ξ'
- output = c.cmd_and_response('CREATE TYPE "%s" ( "%s" int );' % (v1, v2))
- output = c.cmd_and_response('DESC TYPES;')
- self.assertIn(v1, output)
- output = c.cmd_and_response('DESC TYPE "%s";' %(v1,))
- self.assertIn(v2, output)
-
- def test_unicode_copy_roundtrip(self): # CASSANDRA-16539
- with testrun_cqlsh(tty=True, env=self.default_env) as c:
- v1 = 'ࠑ'
- v2 = 'Ξ'
- c.cmd_and_response('CREATE TABLE table_unicode_col (k int PRIMARY KEY, "%s" text );' % (v1,))
- # Sending and reading separately to bypass the echo assert in cmd_and_response.
- # For some reason when running in Python2 pty is emitting an extra "cursor up" escape sequence for this command only.
- c.send('INSERT INTO table_unicode_col (k, "%s") VALUES (0, \'%s\');\n' % (v1, v2,))
- c.read_to_next_prompt()
-
- result1 = c.cmd_and_response('SELECT * FROM table_unicode_col;')
- for v in (v1, v2, '1 rows'):
- self.assertIn(v, result1)
-
- c.cmd_and_response('COPY table_unicode_col TO \'tmp.txt\' WITH HEADER=true AND NUMPROCESSES=1;')
- c.cmd_and_response('TRUNCATE table_unicode_col;')
- output = c.cmd_and_response('SELECT * FROM table_unicode_col;')
- self.assertIn('0 rows', output)
- c.cmd_and_response('COPY table_unicode_col FROM \'tmp.txt\' WITH HEADER=true AND NUMPROCESSES=1;')
-
- result2 = c.cmd_and_response('SELECT * FROM table_unicode_col;')
- self.assertEqual(result1, result2)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org