Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 851502902 -> cdf80d9d1 refs/heads/trunk 8856934fc -> eccf25a17
(cqlsh) parse_for_table_meta errors out on queries with undefined grammars patch by Philip Thompson; reviewed by Mikhail Stepura for CASSANDRA-8262 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cdf80d9d Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cdf80d9d Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cdf80d9d Branch: refs/heads/cassandra-2.1 Commit: cdf80d9d196171376b6fc7aface473a471313efb Parents: 8515029 Author: Philip Thompson <[email protected]> Authored: Wed Nov 5 15:49:59 2014 -0800 Committer: Mikhail Stepura <[email protected]> Committed: Wed Nov 5 15:49:59 2014 -0800 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ bin/cqlsh | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/cdf80d9d/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index ee18be0..2e60f3a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,6 @@ 2.1.2 + * (cqlsh) parse_for_table_meta errors out on queries with undefined + grammars (CASSANDRA-8262) * (cqlsh) Fix SELECT ... TOKEN() function broken in C* 2.1.1 (CASSANDRA-8258) * Fix Cassandra crash when running on JDK8 update 40 (CASSANDRA-8209) * Optimize partitioner tokens (CASSANDRA-8230) http://git-wip-us.apache.org/repos/asf/cassandra/blob/cdf80d9d/bin/cqlsh ---------------------------------------------------------------------- diff --git a/bin/cqlsh b/bin/cqlsh index 763a828..6ace914 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -943,7 +943,10 @@ class Shell(cmd.Cmd): return result def parse_for_table_meta(self, query_string): - parsed = cqlruleset.cql_parse(query_string)[1] + try: + parsed = cqlruleset.cql_parse(query_string)[1] + except IndexError: + return None ks = self.cql_unprotect_name(parsed.get_binding('ksname', None)) cf = self.cql_unprotect_name(parsed.get_binding('cfname')) return self.get_table_meta(ks, cf) @@ -1010,6 +1013,8 @@ class Shell(cmd.Cmd): def print_static_result(self, rows, table_meta): if not rows: + if not table_meta: + return # print header only colnames = table_meta.columns.keys() # full header formatted_names = [self.myformat_colname(name, table_meta) for name in colnames]
