Fix cqlsh DESC TYPES errors

Patch by Adam Holmberg; reviewed by Tyler Hobbs for CASSANDRA-12914
This commit is contained in:
Adam Holmberg 2016-11-29 11:24:33 -06:00 committed by Tyler Hobbs
parent 4fff69fcbe
commit d38bf9faa4
2 changed files with 17 additions and 12 deletions

View File

@ -1,4 +1,5 @@
2.2.9
* cqlsh: fix DESC TYPES errors (CASSANDRA-12914)
* Fix leak on skipped SSTables in sstableupgrade (CASSANDRA-12899)
* Avoid blocking gossip during pending range calculation (CASSANDRA-12281)
* Fix purgeability of tombstones with max timestamp (CASSANDRA-12792)

View File

@ -1497,12 +1497,10 @@ class Shell(cmd.Cmd):
name = protect_name(ksmeta.name)
print 'Keyspace %s' % (name,)
print '---------%s' % ('-' * len(name))
cmd.Cmd.columnize(self, protect_names(ksmeta.functions.keys()))
print
self._columnize_unicode(ksmeta.functions.keys())
else:
ksmeta = self.get_keyspace_meta(ksname)
cmd.Cmd.columnize(self, protect_names(ksmeta.functions.keys()))
print
self._columnize_unicode(ksmeta.functions.keys())
def describe_function(self, ksname, functionname):
if ksname is None:
@ -1524,12 +1522,10 @@ class Shell(cmd.Cmd):
name = protect_name(ksmeta.name)
print 'Keyspace %s' % (name,)
print '---------%s' % ('-' * len(name))
cmd.Cmd.columnize(self, protect_names(ksmeta.aggregates.keys()))
print
self._columnize_unicode(ksmeta.aggregates.keys())
else:
ksmeta = self.get_keyspace_meta(ksname)
cmd.Cmd.columnize(self, protect_names(ksmeta.aggregates.keys()))
print
self._columnize_unicode(ksmeta.aggregates.keys())
def describe_aggregate(self, ksname, aggregatename):
if ksname is None:
@ -1551,12 +1547,10 @@ class Shell(cmd.Cmd):
name = protect_name(ksmeta.name)
print 'Keyspace %s' % (name,)
print '---------%s' % ('-' * len(name))
cmd.Cmd.columnize(self, protect_names(ksmeta.user_types.keys()))
print
self._columnize_unicode(ksmeta.user_types.keys(), quote=True)
else:
ksmeta = self.get_keyspace_meta(ksname)
cmd.Cmd.columnize(self, protect_names(ksmeta.user_types.keys()))
print
self._columnize_unicode(ksmeta.user_types.keys(), quote=True)
def describe_usertype(self, ksname, typename):
if ksname is None:
@ -1572,6 +1566,16 @@ class Shell(cmd.Cmd):
print usertype.as_cql_query(formatted=True)
print
def _columnize_unicode(self, name_list, quote=False):
"""
Used when columnizing identifiers that may contain unicode
"""
names = [n.encode('utf-8') for n in name_list]
if quote:
names = protect_names(names)
cmd.Cmd.columnize(self, names)
print
def describe_cluster(self):
print '\nCluster: %s' % self.get_cluster_name()
p = trim_if_present(self.get_partitioner(), 'org.apache.cassandra.dht.')