From 971d6495438f2a344233b5579b9c86c248b7c62c Mon Sep 17 00:00:00 2001 From: Yuki Morishita Date: Fri, 11 Mar 2016 16:20:33 -0600 Subject: [PATCH] (cqlsh) Fix error when result is 0 rows with EXPAND ON patch by yukim; reviewed by thobbs for CASSANDRA-11092 --- CHANGES.txt | 1 + bin/cqlsh.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 87bb0c04e6..b37ef848ab 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.2.6 + * (cqlsh) Fix error when result is 0 rows with EXPAND ON (CASSANDRA-11092) * Fix intra-node serialization issue for multicolumn-restrictions (CASSANDRA-11196) * Non-obsoleting compaction operations over compressed files can impose rate limit on normal reads (CASSANDRA-11301) * Add missing newline at end of bin/cqlsh (CASSANDRA-11325) diff --git a/bin/cqlsh.py b/bin/cqlsh.py index 9082d72492..d1353179d4 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -1312,8 +1312,13 @@ class Shell(cmd.Cmd): def print_static_result(self, column_names, rows, table_meta): if not column_names and not table_meta: return + column_names = column_names or table_meta.columns.keys() formatted_names = [self.myformat_colname(name, table_meta) for name in column_names] + if not rows: + # print header only + self.print_formatted_result(formatted_names, None) + return formatted_values = [map(self.myformat_value, row.values()) for row in rows] if self.expand_enabled: