Updated Branches:
  refs/heads/cassandra-1.2 4f75875c2 -> 3f883bf4d

cqlsh: Print maps ordered by key, sort sets

patch by Aleksey Yeschenko; reviewed by Brandon Williams for
CASSANDRA-5413


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3f883bf4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3f883bf4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3f883bf4

Branch: refs/heads/cassandra-1.2
Commit: 3f883bf4d514cf8175d5d7bcbb6af16908905bdb
Parents: 4f75875
Author: Aleksey Yeschenko <alek...@apache.org>
Authored: Tue Apr 2 22:08:59 2013 +0300
Committer: Aleksey Yeschenko <alek...@apache.org>
Committed: Tue Apr 2 22:08:59 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                  |    1 +
 pylib/cqlshlib/formatting.py |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3f883bf4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7e906ce..58ba39a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -18,6 +18,7 @@
  * Fix writetime/ttl functions on null values (CASSANDRA-5341)
  * Fix NPE during cql3 select with token() (CASSANDRA-5404)
  * IndexHelper.skipBloomFilters won't skip non-SHA filters (CASSANDRA-5385)
+ * cqlsh: Print maps ordered by key, sort sets (CASSANDRA-5413)
 Merged from 1.1:
  * cli: Quote ks and cf names in schema output when needed (CASSANDRA-5052)
  * Fix bad default for min/max timestamp in SSTableMetadata (CASSANDRA-5372)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3f883bf4/pylib/cqlshlib/formatting.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py
index b970eb9..a3d4666 100644
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@ -202,7 +202,7 @@ def format_value_list(val, encoding, colormap, time_format, 
float_precision, sub
 
 @formatter_for('set')
 def format_value_set(val, encoding, colormap, time_format, float_precision, 
subtypes, nullval, **_):
-    return format_simple_collection(subtypes[0], val, '{', '}', encoding, 
colormap,
+    return format_simple_collection(subtypes[0], sorted(val), '{', '}', 
encoding, colormap,
                                     time_format, float_precision, nullval)
 
 @formatter_for('map')
@@ -213,7 +213,7 @@ def format_value_map(val, encoding, colormap, time_format, 
float_precision, subt
                             nullval=nullval)
 
     subkeytype, subvaltype = subtypes
-    subs = [(subformat(k, subkeytype), subformat(v, subvaltype)) for (k, v) in 
val.items()]
+    subs = [(subformat(k, subkeytype), subformat(v, subvaltype)) for (k, v) in 
sorted(val.items())]
     bval = '{' + ', '.join(k.strval + ': ' + v.strval for (k, v) in subs) + '}'
     lb, comma, colon, rb = [colormap['collection'] + s + colormap['reset']
                             for s in ('{', ', ', ': ', '}')]

Reply via email to