Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C3736200BDC for ; Tue, 29 Nov 2016 22:36:02 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C2650160B28; Tue, 29 Nov 2016 21:36:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 17D1A160B23 for ; Tue, 29 Nov 2016 22:36:01 +0100 (CET) Received: (qmail 25965 invoked by uid 500); 29 Nov 2016 21:36:00 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 25709 invoked by uid 99); 29 Nov 2016 21:36:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Nov 2016 21:36:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 920C1F0BF6; Tue, 29 Nov 2016 21:36:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tylerhobbs@apache.org To: commits@cassandra.apache.org Date: Tue, 29 Nov 2016 21:36:03 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [04/15] cassandra git commit: Fix cqlsh DESC TYPES errors archived-at: Tue, 29 Nov 2016 21:36:02 -0000 Fix cqlsh DESC TYPES errors Patch by Adam Holmberg; reviewed by Tyler Hobbs for CASSANDRA-12914 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d38bf9fa Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d38bf9fa Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d38bf9fa Branch: refs/heads/cassandra-3.11 Commit: d38bf9faa47ebd4ea4edc9c6afa17abe48dbdc9e Parents: 4fff69f Author: Adam Holmberg Authored: Tue Nov 29 11:24:33 2016 -0600 Committer: Tyler Hobbs Committed: Tue Nov 29 15:30:09 2016 -0600 ---------------------------------------------------------------------- CHANGES.txt | 1 + bin/cqlsh.py | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/d38bf9fa/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index cc8ef21..d951b07 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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) http://git-wip-us.apache.org/repos/asf/cassandra/blob/d38bf9fa/bin/cqlsh.py ---------------------------------------------------------------------- diff --git a/bin/cqlsh.py b/bin/cqlsh.py index 514fada..a9c5ff1 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -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.')