Updated Branches: refs/heads/trunk 62b90340d -> 3828cc519
cqlsh: handle CUSTOM 2i in DESCRIBE output patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for CASSANDRA-5760 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f79a2d3a Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f79a2d3a Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f79a2d3a Branch: refs/heads/trunk Commit: f79a2d3a6f982c25ecf79010a6e1d9b538462600 Parents: f5b224c Author: Aleksey Yeschenko <alek...@apache.org> Authored: Mon Jul 15 18:35:33 2013 +0300 Committer: Aleksey Yeschenko <alek...@apache.org> Committed: Mon Jul 15 18:35:33 2013 +0300 ---------------------------------------------------------------------- CHANGES.txt | 1 + bin/cqlsh | 14 ++++++++++---- pylib/cqlshlib/cql3handling.py | 5 +++++ 3 files changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f79a2d3a/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 0253d13..5cec576 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -14,6 +14,7 @@ * Expose native protocol server status in nodetool info (CASSANDRA-5735) * Fix pathetic performance of range tombstones (CASSANDRA-5677) * Fix querying with an empty (impossible) range (CASSANDRA-5573) + * cqlsh: handle CUSTOM 2i in DESCRIBE output (CASSANDRA-5760) 1.2.6 http://git-wip-us.apache.org/repos/asf/cassandra/blob/f79a2d3a/bin/cqlsh ---------------------------------------------------------------------- diff --git a/bin/cqlsh b/bin/cqlsh index 999d1d1..62b5500 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -32,7 +32,7 @@ exit 1 from __future__ import with_statement description = "CQL Shell for Apache Cassandra" -version = "3.1.2" +version = "3.1.3" from StringIO import StringIO from itertools import groupby @@ -1447,9 +1447,15 @@ class Shell(cmd.Cmd): for col in indexed_columns: out.write('\n') - # guess CQL can't represent index_type or index_options - out.write('CREATE INDEX %s ON %s (%s);\n' - % (col.index_name, cfname, self.cql_protect_name(col.name))) + if col.index_type != 'CUSTOM': + out.write('CREATE INDEX %s ON %s (%s);\n' + % (col.index_name, cfname, self.cql_protect_name(col.name))) + else: + out.write("CREATE CUSTOM INDEX %s ON %s (%s) USING '%s';\n" + % (col.index_name, + cfname, + self.cql_protect_name(col.name), + col.index_options[u'class_name'])) def describe_keyspaces(self): print http://git-wip-us.apache.org/repos/asf/cassandra/blob/f79a2d3a/pylib/cqlshlib/cql3handling.py ---------------------------------------------------------------------- diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py index 92701d6..c83c94d 100644 --- a/pylib/cqlshlib/cql3handling.py +++ b/pylib/cqlshlib/cql3handling.py @@ -1395,6 +1395,8 @@ CqlRuleSet.append_rules(syntax_rules) class CqlColumnDef: index_name = None + index_type = None + index_options = {} def __init__(self, name, cqltype): self.name = name @@ -1409,6 +1411,9 @@ class CqlColumnDef: colname = layout[u'column'] c = cls(colname, lookup_casstype(layout[u'validator'])) c.index_name = layout[u'index_name'] + c.index_type = layout[u'index_type'] + if c.index_type == 'CUSTOM': + c.index_options = json.loads(layout[u'index_options']) return c def __str__(self):