You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/06/27 00:15:26 UTC

[1/5] git commit: cqlsh: Don't show 'null' in place of empty values

Updated Branches:
  refs/heads/trunk 3d4e470ba -> 6def8223f


cqlsh: Don't show 'null' in place of empty values

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


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

Branch: refs/heads/trunk
Commit: 340a66891c7eb5e550b8a72401de930cb4c5c392
Parents: 54266ea
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Thu Jun 27 00:36:46 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Thu Jun 27 00:36:46 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                 |  1 +
 bin/cqlsh                                   | 30 ++++++++++++++++++------
 pylib/cqlshlib/displaying.py                |  4 ++--
 pylib/cqlshlib/formatting.py                |  6 +++--
 pylib/cqlshlib/test/test_cqlsh_output.py    | 10 ++++----
 pylib/cqlshlib/test/test_keyspace_init2.cql |  4 ++++
 6 files changed, 39 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/340a6689/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index cb3fede..94830fd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 1.2.7
  * Fix serialization of the LEFT gossip value (CASSANDRA-5696)
+ * cqlsh: Don't show 'null' in place of empty values (CASSANDRA-5675)
 
 1.2.6
  * Fix tracing when operation completes before all responses arrive (CASSANDRA-5668)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/340a6689/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 70b70f5..9f1e6cf 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -567,6 +567,17 @@ class Shell(cmd.Cmd):
     def myformat_colname(self, name, nametype):
         return self.myformat_value(name, nametype, colormap=COLUMN_NAME_COLORS)
 
+    # cql/cursor.py:Cursor.decode_row() function, modified to not turn '' into None.
+    def decode_row(self, cursor, row):
+        values = []
+        bytevals = cursor.columnvalues(row)
+        for val, vtype, nameinfo in zip(bytevals, cursor.column_types, cursor.name_info):
+            if val == '':
+                values.append(val)
+            else:
+                values.append(cursor.decoder.decode_value(val, vtype, nameinfo[0]))
+        return values
+
     def report_connection(self):
         self.show_host()
         self.show_version()
@@ -1115,7 +1126,7 @@ class Shell(cmd.Cmd):
         colnames = [d[0] for d in cursor.description]
         colnames_t = [(name, self.get_nametype(cursor, n)) for (n, name) in enumerate(colnames)]
         formatted_names = [self.myformat_colname(name, nametype) for (name, nametype) in colnames_t]
-        formatted_values = [map(self.myformat_value, row, cursor.column_types) for row in cursor]
+        formatted_values = [map(self.myformat_value, self.decode_row(cursor, row), cursor.column_types) for row in cursor.result]
         if self.expand_enabled:
             self.print_formatted_result_vertically(formatted_names, formatted_values)
         else:
@@ -1153,11 +1164,12 @@ class Shell(cmd.Cmd):
             self.writeresult('')
 
     def print_dynamic_result(self, cursor):
-        for row in cursor:
+        for row in cursor.result:
+            cursor.fetchone()
             colnames = [d[0] for d in cursor.description]
             colnames_t = [(name, self.get_nametype(cursor, n)) for (n, name) in enumerate(colnames)]
             colnames = [self.myformat_colname(name, nametype) for (name, nametype) in colnames_t]
-            colvals = map(self.myformat_value, row, cursor.column_types)
+            colvals = map(self.myformat_value, self.decode_row(cursor, row), cursor.column_types)
             line = ' | '.join('%s,%s' % (n.coloredval, v.coloredval) for (n, v) in zip(colnames, colvals))
             self.writeresult(' ' + line)
 
@@ -1680,14 +1692,18 @@ class Shell(cmd.Cmd):
     def do_import_row(self, columns, nullval, layout, row):
         rowmap = {}
         for name, value in zip(columns, row):
+            type = layout.get_column(name).cqltype
+            if issubclass(type, ReversedType):
+                type = type.subtypes[0]
+            cqltype = type.cql_parameterized_type()
+
             if value != nullval:
-                type = layout.get_column(name).cqltype
-                if issubclass(type, ReversedType):
-                    type = type.subtypes[0]
-                if type.cql_parameterized_type() in ('ascii', 'text', 'timestamp', 'inet'):
+                if cqltype in ('ascii', 'text', 'timestamp', 'inet'):
                     rowmap[name] = self.cql_protect_value(value)
                 else:
                     rowmap[name] = value
+            elif name in layout.column_aliases and not type.empty_binary_ok:
+                rowmap[name] = 'blobAs%s(0x)' % cqltype.title()
             else:
                 rowmap[name] = 'null'
         return self.do_import_insert(layout, rowmap)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/340a6689/pylib/cqlshlib/displaying.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/displaying.py b/pylib/cqlshlib/displaying.py
index 22ff763..13e3cf4 100644
--- a/pylib/cqlshlib/displaying.py
+++ b/pylib/cqlshlib/displaying.py
@@ -93,7 +93,7 @@ DEFAULT_VALUE_COLORS = dict(
     default=YELLOW,
     text=YELLOW,
     error=RED,
-    hex=DARK_MAGENTA,
+    blob=DARK_MAGENTA,
     timestamp=GREEN,
     int=GREEN,
     float=GREEN,
@@ -107,6 +107,6 @@ DEFAULT_VALUE_COLORS = dict(
 
 COLUMN_NAME_COLORS = defaultdict(lambda: MAGENTA,
     error=RED,
-    hex=DARK_MAGENTA,
+    blob=DARK_MAGENTA,
     reset=ANSI_RESET,
 )

http://git-wip-us.apache.org/repos/asf/cassandra/blob/340a6689/pylib/cqlshlib/formatting.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py
index a3d4666..87f692b 100644
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@ -79,7 +79,7 @@ def color_text(bval, colormap, displaywidth=None):
 
     if displaywidth is None:
         displaywidth = len(bval)
-    tbr = _make_turn_bits_red_f(colormap['hex'], colormap['text'])
+    tbr = _make_turn_bits_red_f(colormap['blob'], colormap['text'])
     coloredval = colormap['text'] + bits_to_turn_red_re.sub(tbr, bval) + colormap['reset']
     if colormap['text']:
         displaywidth -= bval.count(r'\\')
@@ -96,6 +96,8 @@ def format_value_default(val, colormap, **_):
 _formatters = {}
 
 def format_value(cqltype, val, **kwargs):
+    if val == '' and not cqltype.empty_binary_ok:
+        return format_value_default(val, **kwargs)
     formatter = _formatters.get(cqltype.typename, format_value_default)
     return formatter(val, subtypes=cqltype.subtypes, **kwargs)
 
@@ -108,7 +110,7 @@ def formatter_for(typname):
 @formatter_for('blob')
 def format_value_blob(val, colormap, **_):
     bval = '0x' + ''.join('%02x' % ord(c) for c in val)
-    return colorme(bval, colormap, 'hex')
+    return colorme(bval, colormap, 'blob')
 
 def format_python_formatted_type(val, colormap, color):
     bval = str(val)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/340a6689/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 6ca251e..07abc29 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -153,7 +153,7 @@ class TestCqlshOutput(BaseTestCase):
              MMMMM
             -------
 
-                 4
+                 5
                  G
 
             """),
@@ -371,7 +371,7 @@ class TestCqlshOutput(BaseTestCase):
         self.assertCqlverQueriesGiveColoredOutput((
             ('''select intcol, bigintcol, varintcol \
                   from has_all_types \
-                 where num in (0, 1, 2, 3);''', """
+                 where num in (0, 1, 2, 3, 4);''', """
              intcol      | bigintcol            | varintcol
              MMMMMM        MMMMMMMMM              MMMMMMMMM
             -------------+----------------------+-----------------------------
@@ -384,12 +384,12 @@ class TestCqlshOutput(BaseTestCase):
              GGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGGGGGGGGG
              -2147483648 | -9223372036854775808 | -10000000000000000000000000
              GGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGGGGGGGGG
-
+                         |                      |
             """),
 
             ('''select decimalcol, doublecol, floatcol \
                   from has_all_types \
-                 where num in (0, 1, 2, 3);''', """
+                 where num in (0, 1, 2, 3, 4);''', """
              decimalcol       | doublecol | floatcol
              MMMMMMMMMM         MMMMMMMMM   MMMMMMMM
             ------------------+-----------+----------
@@ -402,7 +402,7 @@ class TestCqlshOutput(BaseTestCase):
              GGGGGGGGGGGGGGGG     GGGGGGG      GGGGG
              10.0000000000000 |   -1004.1 |    1e+08
              GGGGGGGGGGGGGGGG     GGGGGGG      GGGGG
-
+                              |           |
             """),
         ), cqlver=(2, 3))
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/340a6689/pylib/cqlshlib/test/test_keyspace_init2.cql
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_keyspace_init2.cql b/pylib/cqlshlib/test/test_keyspace_init2.cql
index ca5f4a4..7194e8a 100644
--- a/pylib/cqlshlib/test/test_keyspace_init2.cql
+++ b/pylib/cqlshlib/test/test_keyspace_init2.cql
@@ -44,6 +44,10 @@ VALUES (3, -2147483648, '''''''', -9223372036854775808, '80', 'false',
         10.0000000000000, -1004.10, 100000000.9, '龍馭鬱', '2038-01-19T03:14-1200',
         ffffffff-ffff-1fff-8fff-ffffffffffff, '''', -10000000000000000000000000);
 
+INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,
+                           decimalcol, doublecol, floatcol, textcol,
+                           timestampcol, uuidcol, varcharcol, varintcol)
+VALUES (4, '', '', '', '', '', '', '', '', '', '', '', '', '');
 
 
 CREATE TABLE has_value_encoding_errors (


[4/5] git commit: Merge branch 'trunk' of https://git-wip-us.apache.org/repos/asf/cassandra into trunk

Posted by al...@apache.org.
Merge branch 'trunk' of https://git-wip-us.apache.org/repos/asf/cassandra into trunk


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

Branch: refs/heads/trunk
Commit: d8302d79a85da67bbbb6e483274599bcac6b15e3
Parents: f897843 3d4e470
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Thu Jun 27 01:12:50 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Thu Jun 27 01:12:50 2013 +0300

----------------------------------------------------------------------

----------------------------------------------------------------------



[5/5] git commit: Merge branch 'cassandra-1.2' into trunk

Posted by al...@apache.org.
Merge branch 'cassandra-1.2' into trunk


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

Branch: refs/heads/trunk
Commit: 6def8223f5e0dae5fae051986f5f428270db580f
Parents: d8302d7 e4050e6
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Thu Jun 27 01:15:04 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Thu Jun 27 01:15:04 2013 +0300

----------------------------------------------------------------------

----------------------------------------------------------------------



[2/5] git commit: Merge branch 'cassandra-1.2' into trunk

Posted by al...@apache.org.
Merge branch 'cassandra-1.2' into trunk

Conflicts:
	bin/cqlsh
	pylib/cqlshlib/test/test_cqlsh_output.py
	pylib/cqlshlib/test/test_keyspace_init2.cql


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

Branch: refs/heads/trunk
Commit: f89784339c87d17152d80ed503703ba5b58e45be
Parents: e5e7225 340a668
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Thu Jun 27 01:01:18 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Thu Jun 27 01:01:18 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                  |  1 +
 bin/cqlsh                                    | 25 ++++++++++++++++++-----
 pylib/cqlshlib/displaying.py                 |  4 ++--
 pylib/cqlshlib/formatting.py                 |  6 ++++--
 pylib/cqlshlib/test/test_cqlsh_completion.py |  2 +-
 pylib/cqlshlib/test/test_cqlsh_output.py     | 15 +++++++++-----
 pylib/cqlshlib/test/test_keyspace_init.cql   |  6 ++++++
 7 files changed, 44 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8978433/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 31cbb05,94830fd..59c9dab
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,75 -1,6 +1,76 @@@
 +2.0
 + * Removed on-heap row cache (CASSANDRA-5348)
 + * use nanotime consistently for node-local timeouts (CASSANDRA-5581)
 + * Avoid unnecessary second pass on name-based queries (CASSANDRA-5577)
 + * Experimental triggers (CASSANDRA-1311)
 + * JEMalloc support for off-heap allocation (CASSANDRA-3997)
 + * Single-pass compaction (CASSANDRA-4180)
 + * Removed token range bisection (CASSANDRA-5518)
 + * Removed compatibility with pre-1.2.5 sstables and network messages
 +   (CASSANDRA-5511)
 + * removed PBSPredictor (CASSANDRA-5455)
 + * CAS support (CASSANDRA-5062, 5441, 5442, 5443, 5619)
 + * Leveled compaction performs size-tiered compactions in L0 
 +   (CASSANDRA-5371, 5439)
 + * Add yaml network topology snitch for mixed ec2/other envs (CASSANDRA-5339)
 + * Log when a node is down longer than the hint window (CASSANDRA-4554)
 + * Optimize tombstone creation for ExpiringColumns (CASSANDRA-4917)
 + * Improve LeveledScanner work estimation (CASSANDRA-5250, 5407)
 + * Replace compaction lock with runWithCompactionsDisabled (CASSANDRA-3430)
 + * Change Message IDs to ints (CASSANDRA-5307)
 + * Move sstable level information into the Stats component, removing the
 +   need for a separate Manifest file (CASSANDRA-4872)
 + * avoid serializing to byte[] on commitlog append (CASSANDRA-5199)
 + * make index_interval configurable per columnfamily (CASSANDRA-3961, CASSANDRA-5650)
 + * add default_time_to_live (CASSANDRA-3974)
 + * add memtable_flush_period_in_ms (CASSANDRA-4237)
 + * replace supercolumns internally by composites (CASSANDRA-3237, 5123)
 + * upgrade thrift to 0.9.0 (CASSANDRA-3719)
 + * drop unnecessary keyspace parameter from user-defined compaction API 
 +   (CASSANDRA-5139)
 + * more robust solution to incomplete compactions + counters (CASSANDRA-5151)
 + * Change order of directory searching for c*.in.sh (CASSANDRA-3983)
 + * Add tool to reset SSTable compaction level for LCS (CASSANDRA-5271)
 + * Allow custom configuration loader (CASSANDRA-5045)
 + * Remove memory emergency pressure valve logic (CASSANDRA-3534)
 + * Reduce request latency with eager retry (CASSANDRA-4705)
 + * cqlsh: Remove ASSUME command (CASSANDRA-5331)
 + * Rebuild BF when loading sstables if bloom_filter_fp_chance
 +   has changed since compaction (CASSANDRA-5015)
 + * remove row-level bloom filters (CASSANDRA-4885)
 + * Change Kernel Page Cache skipping into row preheating (disabled by default)
 +   (CASSANDRA-4937)
 + * Improve repair by deciding on a gcBefore before sending
 +   out TreeRequests (CASSANDRA-4932)
 + * Add an official way to disable compactions (CASSANDRA-5074)
 + * Reenable ALTER TABLE DROP with new semantics (CASSANDRA-3919)
 + * Add binary protocol versioning (CASSANDRA-5436)
 + * Swap THshaServer for TThreadedSelectorServer (CASSANDRA-5530)
 + * Add alias support to SELECT statement (CASSANDRA-5075)
 + * Don't create empty RowMutations in CommitLogReplayer (CASSANDRA-5541)
 + * Use range tombstones when dropping cfs/columns from schema (CASSANDRA-5579)
 + * cqlsh: drop CQL2/CQL3-beta support (CASSANDRA-5585)
 + * Track max/min column names in sstables to be able to optimize slice
 +   queries (CASSANDRA-5514, CASSANDRA-5595, CASSANDRA-5600)
 + * Binary protocol: allow batching already prepared statements (CASSANDRA-4693)
 + * Allow preparing timestamp, ttl and limit in CQL3 queries (CASSANDRA-4450)
 + * Support native link w/o JNA in Java7 (CASSANDRA-3734)
 + * Use SASL authentication in binary protocol v2 (CASSANDRA-5545)
 + * Replace Thrift HsHa with LMAX Disruptor based implementation (CASSANDRA-5582)
 + * cqlsh: Add row count to SELECT output (CASSANDRA-5636)
 + * Include a timestamp with all read commands to determine column expiration
 +   (CASSANDRA-5149)
 + * Streaming 2.0 (CASSANDRA-5286)
 + * Conditional create/drop ks/table/index statements in CQL3 (CASSANDRA-2737)
 + * more pre-table creation property validation (CASSANDRA-5693)
 + * Redesign repair messages (CASSANDRA-5426)
 + * Fix ALTER RENAME post-5125 (CASSANDRA-5702)
 + * Disallow renaming a 2ndary indexed column (CASSANDRA-5705)
 +
 +
  1.2.7
   * Fix serialization of the LEFT gossip value (CASSANDRA-5696)
+  * cqlsh: Don't show 'null' in place of empty values (CASSANDRA-5675)
  
  1.2.6
   * Fix tracing when operation completes before all responses arrive (CASSANDRA-5668)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8978433/bin/cqlsh
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8978433/pylib/cqlshlib/test/test_cqlsh_completion.py
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/test/test_cqlsh_completion.py
index b8f0167,3051378..63296fa
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@@ -125,7 -132,60 +125,7 @@@ class TestCqlshCompletion(CqlshCompleti
          pass
  
      def test_complete_in_create_keyspace(self):
-         self.trycompletions('create keyspace ', '', choices=('<identifier>', '<quotedName>'))
 -        self.trycompletions('create keyspace ', '', choices=('<new_keyspace_name>',))
 -        self.trycompletions('create keyspace moo ', "WITH strategy_class = '")
 -        self.trycompletions("create keyspace '12SomeName' with ", "strategy_class = '")
 -        self.trycompletions("create keyspace moo with strategy_class", " = '")
 -        self.trycompletions("create keyspace moo with strategy_class='",
 -                            choices=self.strategies())
 -        self.trycompletions("create keySPACE 123 with strategy_class='SimpleStrategy' A",
 -                            "ND strategy_options:replication_factor = ")
 -        self.trycompletions("create keyspace fish with strategy_class='SimpleStrategy'"
 -                                  "and strategy_options:replication_factor = ", '',
 -                            choices=('<option_value>',))
 -        self.trycompletions("create keyspace 'PB and J' with strategy_class="
 -                               "'NetworkTopologyStrategy' AND", ' ')
 -        self.trycompletions("create keyspace 'PB and J' with strategy_class="
 -                               "'NetworkTopologyStrategy' AND ", '',
 -                            choices=('<strategy_option_name>',))
 -
 -    def test_complete_in_drop_keyspace(self):
 -        pass
 -
 -    def test_complete_in_create_columnfamily(self):
 -        pass
 -
 -    def test_complete_in_drop_columnfamily(self):
 -        pass
 -
 -    def test_complete_in_truncate(self):
 -        pass
 -
 -    def test_complete_in_alter_columnfamily(self):
 -        pass
 -
 -    def test_complete_in_use(self):
 -        pass
 -
 -    def test_complete_in_create_index(self):
 -        pass
 -
 -    def test_complete_in_drop_index(self):
 -        pass
 -
 -class TestCqlshCompletion_CQL3final(TestCqlshCompletion_CQL2):
 -    cqlver = '3.0.0'
 -    module = cqlsh.cql3handling
 -
 -    def test_complete_on_empty_string(self):
 -        self.trycompletions('', choices=('?', 'ALTER', 'ASSUME', 'BEGIN', 'CAPTURE', 'CONSISTENCY',
 -                                         'COPY', 'CREATE', 'DEBUG', 'DELETE', 'DESC', 'DESCRIBE',
 -                                         'DROP', 'GRANT', 'HELP', 'INSERT', 'LIST', 'REVOKE',
 -                                         'SELECT', 'SHOW', 'SOURCE', 'TRACING', 'EXPAND', 'TRUNCATE',
 -                                         'UPDATE', 'USE', 'exit', 'quit'))
 -
 -    def test_complete_in_create_keyspace(self):
 -        self.trycompletions('create keyspace ', '', choices=('<identifier>', '<quotedName>'))
++        self.trycompletions('create keyspace ', '', choices=('<identifier>', '<quotedName>', 'IF'))
          self.trycompletions('create keyspace moo ',
                              "WITH replication = {'class': '")
          self.trycompletions('create keyspace "12SomeName" with ',

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8978433/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/test/test_cqlsh_output.py
index b74c895,07abc29..aa92a7f
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@@ -141,12 -153,9 +141,12 @@@ class TestCqlshOutput(BaseTestCase)
               MMMMM
              -------
  
-                  4
+                  5
                   G
  
 +
 +            (1 rows)
 +            nnnnnnnn
              """),
  
              ('select COUNT(*) FROM empty_table;', """
@@@ -314,10 -384,7 +314,12 @@@
               GGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGGGGGGGGG
               -2147483648 | -9223372036854775808 | -10000000000000000000000000
               GGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGGGGGGGGG
+                          |                      |
++             nnnnnnnnnnn   nnnnnnnnnnnnnnnnnnnn   nnnnnnnnnnnnnnnnnnnnnnnnnnn
 +
 +
-             (4 rows)
++            (5 rows)
 +            nnnnnnnn
              """),
  
              ('''select decimalcol, doublecol, floatcol \
@@@ -335,12 -402,21 +337,14 @@@
               GGGGGGGGGGGGGGGG     GGGGGGG      GGGGG
               10.0000000000000 |   -1004.1 |    1e+08
               GGGGGGGGGGGGGGGG     GGGGGGG      GGGGG
+                               |           |
 -            """),
 -        ), cqlver=(2, 3))
 -
 -        self.assertQueriesGiveColoredOutput((
 -            ('''select * from dynamic_columns where somekey = 3;''', """
 -             somekey | -0.0001                 | 3.46                 | 99
 -             MMMMMMM   MMMMMMM                   MMMM                   MM
 -            ---------+-------------------------+----------------------+----------------------
++             nnnnnnnnnnnnnnnn     nnnnnnn      nnnnn
  
 -                   3 | negative ten thousandth | three point four six | ninety-nine point oh
 -                   G   YYYYYYYYYYYYYYYYYYYYYYY   YYYYYYYYYYYYYYYYYYYY   YYYYYYYYYYYYYYYYYYYY
  
-             (4 rows)
++            (5 rows)
 +            nnnnnnnn
              """),
 -        ), cqlver=2)
 +        ), cqlver=3)
  
      def test_timestamp_output(self):
          self.assertQueriesGiveColoredOutput((
@@@ -654,6 -777,6 +658,7 @@@
                comment='' AND
                dclocal_read_repair_chance=0.000000 AND
                gc_grace_seconds=864000 AND
++              index_interval=128 AND
                read_repair_chance=0.100000 AND
                replicate_on_write='true' AND
                populate_io_cache_on_flush='false' AND

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8978433/pylib/cqlshlib/test/test_keyspace_init.cql
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/test/test_keyspace_init.cql
index 30a22bc,0000000..e92d5d0
mode 100644,000000..100644
--- a/pylib/cqlshlib/test/test_keyspace_init.cql
+++ b/pylib/cqlshlib/test/test_keyspace_init.cql
@@@ -1,198 -1,0 +1,204 @@@
 +CREATE TABLE has_all_types (
 +    num int PRIMARY KEY,
 +    intcol int,
 +    asciicol ascii,
 +    bigintcol bigint,
 +    blobcol blob,
 +    booleancol boolean,
 +    decimalcol decimal,
 +    doublecol double,
 +    floatcol float,
 +    textcol text,
 +    timestampcol timestamp,
 +    uuidcol uuid,
 +    varcharcol varchar,
 +    varintcol varint
 +) WITH compression = {'sstable_compression':'LZ4Compressor'};
 +
 +INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,
 +                           decimalcol, doublecol, floatcol, textcol,
 +                           timestampcol, uuidcol, varcharcol, varintcol)
 +VALUES (0, -12, 'abcdefg', 1234567890123456789, 0x000102030405fffefd, true,
 +        19952.11882, 1.0, -2.1, 'Voilá!', '2012-05-14 12:53:20+0000',
 +        bd1924e1-6af8-44ae-b5e1-f24131dbd460, '"', 10000000000000000000000000);
 +
 +INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,
 +                           decimalcol, doublecol, floatcol, textcol,
 +                           timestampcol, uuidcol, varcharcol, varintcol)
 +VALUES (1, 2147483647, '__!''$#@!~"', 9223372036854775807, 0xffffffffffffffffff, true,
 +        0.00000000000001, 9999999.999, 99999.99, '∭Ƕ⑮ฑ➳❏''', '1900-01-01+0000',
 +        ffffffff-ffff-ffff-ffff-ffffffffffff, 'newline->
 +<-', 9);
 +
 +INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,
 +                           decimalcol, doublecol, floatcol, textcol,
 +                           timestampcol, uuidcol, varcharcol, varintcol)
 +VALUES (2, 0, '', 0, 0x, false,
 +        0.0, 0.0, 0.0, '', 0,
 +        00000000-0000-0000-0000-000000000000, '', 0);
 +
 +INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,
 +                           decimalcol, doublecol, floatcol, textcol,
 +                           timestampcol, uuidcol, varcharcol, varintcol)
 +VALUES (3, -2147483648, '''''''', -9223372036854775808, 0x80, false,
 +        10.0000000000000, -1004.10, 100000000.9, '龍馭鬱', '2038-01-19T03:14-1200',
 +        ffffffff-ffff-1fff-8fff-ffffffffffff, '''', -10000000000000000000000000);
 +
++INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,
++                           decimalcol, doublecol, floatcol, textcol,
++                           timestampcol, uuidcol, varcharcol, varintcol)
++VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDecimal(0x),
++        blobAsDouble(0x), blobAsFloat(0x), '', blobAsTimestamp(0x), blobAsUuid(0x), '',
++        blobAsVarint(0x));
 +
 +
 +CREATE TABLE has_value_encoding_errors (
 +    pkey ascii PRIMARY KEY,
 +    utf8col blob
 +);
 +
 +INSERT INTO has_value_encoding_errors (pkey, utf8col) VALUES ('A', 0x00ff00ff);
 +ALTER TABLE has_value_encoding_errors ALTER utf8col TYPE text;
 +
 +CREATE TABLE has_key_encoding_errors (
 +    pkey blob PRIMARY KEY,
 +    col text
 +);
 +
 +INSERT INTO has_key_encoding_errors (pkey, col) VALUES (0x00ff028f, 'whatever');
 +ALTER TABLE has_key_encoding_errors ALTER pkey TYPE text;
 +
 +
 +
 +CREATE TABLE empty_table (
 +    lonelykey float primary key,
 +    lonelycol text
 +);
 +
 +
 +
 +CREATE COLUMNFAMILY dynamic_columns (
 +    somekey int,
 +    column1 float,
 +    value text,
 +    PRIMARY KEY(somekey, column1)
 +) WITH COMPACT STORAGE;
 +
 +INSERT INTO dynamic_columns (somekey, column1, value) VALUES (1, 1.2, 'one point two');
 +INSERT INTO dynamic_columns (somekey, column1, value) VALUES (2, 2.3, 'two point three');
 +INSERT INTO dynamic_columns (somekey, column1, value) VALUES (3, 3.46, 'three point four six');
 +INSERT INTO dynamic_columns (somekey, column1, value) VALUES (3, 99.0, 'ninety-nine point oh');
 +INSERT INTO dynamic_columns (somekey, column1, value) VALUES (3, -0.0001, 'negative ten thousandth');
 +
 +
 +
 +CREATE TABLE twenty_rows_table (
 +    a text primary key,
 +    b text
 +);
 +
 +INSERT INTO twenty_rows_table (a, b) VALUES ('1', '1');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('2', '2');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('3', '3');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('4', '4');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('5', '5');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('6', '6');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('7', '7');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('8', '8');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('9', '9');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('10', '10');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('11', '11');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('12', '12');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('13', '13');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('14', '14');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('15', '15');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('16', '16');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('17', '17');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('18', '18');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('19', '19');
 +INSERT INTO twenty_rows_table (a, b) VALUES ('20', '20');
 +
 +
 +CREATE TABLE undefined_values_table (
 +    k text PRIMARY KEY,
 +    c text,
 +    notthere text
 +);
 +
 +INSERT INTO undefined_values_table (k, c) VALUES ('k1', 'c1');
 +INSERT INTO undefined_values_table (k, c) VALUES ('k2', 'c2');
 +
 +
 +
 +CREATE TABLE ascii_with_invalid_and_special_chars (
 +    k int PRIMARY KEY,
 +    val blob
 +);
 +
 +-- "newline:\n"
 +INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (0, 0x6e65776c696e653a0a);
 +-- "return\rand null\0!"
 +INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (1, 0x72657475726e0d616e64206e756c6c0021);
 +-- "\x00\x01\x02\x03\x04\x05control chars\x06\x07"
 +INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (2, 0x000102030405636f6e74726f6c2063686172730607);
 +-- "\xfe\xffbyte order mark"
 +INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (3, 0xfeff62797465206f72646572206d61726b);
 +-- "fake special chars\\x00\\n"
 +INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (4, 0x66616b65207370656369616c2063686172735c7830305c6e);
 +
 +ALTER TABLE ascii_with_invalid_and_special_chars ALTER val TYPE ascii;
 +
 +
 +
 +CREATE TABLE utf8_with_special_chars (
 +    k int PRIMARY KEY,
 +    val text
 +);
 +
 +INSERT INTO utf8_with_special_chars (k, val) VALUES (0, 'Normal string');
 +INSERT INTO utf8_with_special_chars (k, val) VALUES (1, 'Text with
 +newlines
 +');
 +INSERT INTO utf8_with_special_chars (k, val) VALUES (2, 'Text with embedded  char');
 +INSERT INTO utf8_with_special_chars (k, val) VALUES (3, 'ⓈⓅⒺⒸⒾⒶⓁ ⒞⒣⒜⒭⒮ and normal ones');
 +INSERT INTO utf8_with_special_chars (k, val) VALUES (4, 'double wides: ⾑⾤⾚');
 +INSERT INTO utf8_with_special_chars (k, val) VALUES (5, 'zero width​space');
 +INSERT INTO utf8_with_special_chars (k, val) VALUES (6, 'fake special chars\x00\n');
 +
 +
 +CREATE TABLE empty_composite_table (
 +    lonelykey float,
 +    lonelycol text,
 +    lonelyval int,
 +    primary key (lonelykey, lonelycol)
 +);
 +
 +CREATE TABLE twenty_rows_composite_table (
 +    a text,
 +    b text,
 +    c text,
 +    primary key (a, b)
 +);
 +
 +-- all in the same storage engine row:
 +
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '1', '1');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '2', '2');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '3', '3');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '4', '4');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '5', '5');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '6', '6');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '7', '7');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '8', '8');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '9', '9');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '10', '10');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '11', '11');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '12', '12');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '13', '13');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '14', '14');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '15', '15');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '16', '16');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '17', '17');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '18', '18');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '19', '19');
 +INSERT INTO twenty_rows_composite_table (a, b, c) VALUES ('A', '20', '20');


[3/5] git commit: cqlsh: Don't show 'null' in place of empty values

Posted by al...@apache.org.
cqlsh: Don't show 'null' in place of empty values

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


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

Branch: refs/heads/trunk
Commit: e4050e609cc4bdc4b60ffb829774a7ce09dad726
Parents: 33a3d2c
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Thu Jun 27 00:36:46 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Thu Jun 27 01:03:07 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                 |  1 +
 bin/cqlsh                                   | 30 ++++++++++++++++++------
 pylib/cqlshlib/displaying.py                |  4 ++--
 pylib/cqlshlib/formatting.py                |  6 +++--
 pylib/cqlshlib/test/test_cqlsh_output.py    | 10 ++++----
 pylib/cqlshlib/test/test_keyspace_init2.cql |  4 ++++
 6 files changed, 39 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e4050e60/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 24d4c9e..e7e8652 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,7 @@
 1.2.7
  * Fix serialization of the LEFT gossip value (CASSANDRA-5696)
  * Pig: support for cql3 tables (CASSANDRA-5234)
+ * cqlsh: Don't show 'null' in place of empty values (CASSANDRA-5675)
 
 1.2.6
  * Fix tracing when operation completes before all responses arrive (CASSANDRA-5668)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e4050e60/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 70b70f5..9f1e6cf 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -567,6 +567,17 @@ class Shell(cmd.Cmd):
     def myformat_colname(self, name, nametype):
         return self.myformat_value(name, nametype, colormap=COLUMN_NAME_COLORS)
 
+    # cql/cursor.py:Cursor.decode_row() function, modified to not turn '' into None.
+    def decode_row(self, cursor, row):
+        values = []
+        bytevals = cursor.columnvalues(row)
+        for val, vtype, nameinfo in zip(bytevals, cursor.column_types, cursor.name_info):
+            if val == '':
+                values.append(val)
+            else:
+                values.append(cursor.decoder.decode_value(val, vtype, nameinfo[0]))
+        return values
+
     def report_connection(self):
         self.show_host()
         self.show_version()
@@ -1115,7 +1126,7 @@ class Shell(cmd.Cmd):
         colnames = [d[0] for d in cursor.description]
         colnames_t = [(name, self.get_nametype(cursor, n)) for (n, name) in enumerate(colnames)]
         formatted_names = [self.myformat_colname(name, nametype) for (name, nametype) in colnames_t]
-        formatted_values = [map(self.myformat_value, row, cursor.column_types) for row in cursor]
+        formatted_values = [map(self.myformat_value, self.decode_row(cursor, row), cursor.column_types) for row in cursor.result]
         if self.expand_enabled:
             self.print_formatted_result_vertically(formatted_names, formatted_values)
         else:
@@ -1153,11 +1164,12 @@ class Shell(cmd.Cmd):
             self.writeresult('')
 
     def print_dynamic_result(self, cursor):
-        for row in cursor:
+        for row in cursor.result:
+            cursor.fetchone()
             colnames = [d[0] for d in cursor.description]
             colnames_t = [(name, self.get_nametype(cursor, n)) for (n, name) in enumerate(colnames)]
             colnames = [self.myformat_colname(name, nametype) for (name, nametype) in colnames_t]
-            colvals = map(self.myformat_value, row, cursor.column_types)
+            colvals = map(self.myformat_value, self.decode_row(cursor, row), cursor.column_types)
             line = ' | '.join('%s,%s' % (n.coloredval, v.coloredval) for (n, v) in zip(colnames, colvals))
             self.writeresult(' ' + line)
 
@@ -1680,14 +1692,18 @@ class Shell(cmd.Cmd):
     def do_import_row(self, columns, nullval, layout, row):
         rowmap = {}
         for name, value in zip(columns, row):
+            type = layout.get_column(name).cqltype
+            if issubclass(type, ReversedType):
+                type = type.subtypes[0]
+            cqltype = type.cql_parameterized_type()
+
             if value != nullval:
-                type = layout.get_column(name).cqltype
-                if issubclass(type, ReversedType):
-                    type = type.subtypes[0]
-                if type.cql_parameterized_type() in ('ascii', 'text', 'timestamp', 'inet'):
+                if cqltype in ('ascii', 'text', 'timestamp', 'inet'):
                     rowmap[name] = self.cql_protect_value(value)
                 else:
                     rowmap[name] = value
+            elif name in layout.column_aliases and not type.empty_binary_ok:
+                rowmap[name] = 'blobAs%s(0x)' % cqltype.title()
             else:
                 rowmap[name] = 'null'
         return self.do_import_insert(layout, rowmap)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e4050e60/pylib/cqlshlib/displaying.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/displaying.py b/pylib/cqlshlib/displaying.py
index 22ff763..13e3cf4 100644
--- a/pylib/cqlshlib/displaying.py
+++ b/pylib/cqlshlib/displaying.py
@@ -93,7 +93,7 @@ DEFAULT_VALUE_COLORS = dict(
     default=YELLOW,
     text=YELLOW,
     error=RED,
-    hex=DARK_MAGENTA,
+    blob=DARK_MAGENTA,
     timestamp=GREEN,
     int=GREEN,
     float=GREEN,
@@ -107,6 +107,6 @@ DEFAULT_VALUE_COLORS = dict(
 
 COLUMN_NAME_COLORS = defaultdict(lambda: MAGENTA,
     error=RED,
-    hex=DARK_MAGENTA,
+    blob=DARK_MAGENTA,
     reset=ANSI_RESET,
 )

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e4050e60/pylib/cqlshlib/formatting.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py
index a3d4666..87f692b 100644
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@ -79,7 +79,7 @@ def color_text(bval, colormap, displaywidth=None):
 
     if displaywidth is None:
         displaywidth = len(bval)
-    tbr = _make_turn_bits_red_f(colormap['hex'], colormap['text'])
+    tbr = _make_turn_bits_red_f(colormap['blob'], colormap['text'])
     coloredval = colormap['text'] + bits_to_turn_red_re.sub(tbr, bval) + colormap['reset']
     if colormap['text']:
         displaywidth -= bval.count(r'\\')
@@ -96,6 +96,8 @@ def format_value_default(val, colormap, **_):
 _formatters = {}
 
 def format_value(cqltype, val, **kwargs):
+    if val == '' and not cqltype.empty_binary_ok:
+        return format_value_default(val, **kwargs)
     formatter = _formatters.get(cqltype.typename, format_value_default)
     return formatter(val, subtypes=cqltype.subtypes, **kwargs)
 
@@ -108,7 +110,7 @@ def formatter_for(typname):
 @formatter_for('blob')
 def format_value_blob(val, colormap, **_):
     bval = '0x' + ''.join('%02x' % ord(c) for c in val)
-    return colorme(bval, colormap, 'hex')
+    return colorme(bval, colormap, 'blob')
 
 def format_python_formatted_type(val, colormap, color):
     bval = str(val)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e4050e60/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 6ca251e..07abc29 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -153,7 +153,7 @@ class TestCqlshOutput(BaseTestCase):
              MMMMM
             -------
 
-                 4
+                 5
                  G
 
             """),
@@ -371,7 +371,7 @@ class TestCqlshOutput(BaseTestCase):
         self.assertCqlverQueriesGiveColoredOutput((
             ('''select intcol, bigintcol, varintcol \
                   from has_all_types \
-                 where num in (0, 1, 2, 3);''', """
+                 where num in (0, 1, 2, 3, 4);''', """
              intcol      | bigintcol            | varintcol
              MMMMMM        MMMMMMMMM              MMMMMMMMM
             -------------+----------------------+-----------------------------
@@ -384,12 +384,12 @@ class TestCqlshOutput(BaseTestCase):
              GGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGGGGGGGGG
              -2147483648 | -9223372036854775808 | -10000000000000000000000000
              GGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGG   GGGGGGGGGGGGGGGGGGGGGGGGGGG
-
+                         |                      |
             """),
 
             ('''select decimalcol, doublecol, floatcol \
                   from has_all_types \
-                 where num in (0, 1, 2, 3);''', """
+                 where num in (0, 1, 2, 3, 4);''', """
              decimalcol       | doublecol | floatcol
              MMMMMMMMMM         MMMMMMMMM   MMMMMMMM
             ------------------+-----------+----------
@@ -402,7 +402,7 @@ class TestCqlshOutput(BaseTestCase):
              GGGGGGGGGGGGGGGG     GGGGGGG      GGGGG
              10.0000000000000 |   -1004.1 |    1e+08
              GGGGGGGGGGGGGGGG     GGGGGGG      GGGGG
-
+                              |           |
             """),
         ), cqlver=(2, 3))
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e4050e60/pylib/cqlshlib/test/test_keyspace_init2.cql
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_keyspace_init2.cql b/pylib/cqlshlib/test/test_keyspace_init2.cql
index ca5f4a4..7194e8a 100644
--- a/pylib/cqlshlib/test/test_keyspace_init2.cql
+++ b/pylib/cqlshlib/test/test_keyspace_init2.cql
@@ -44,6 +44,10 @@ VALUES (3, -2147483648, '''''''', -9223372036854775808, '80', 'false',
         10.0000000000000, -1004.10, 100000000.9, '龍馭鬱', '2038-01-19T03:14-1200',
         ffffffff-ffff-1fff-8fff-ffffffffffff, '''', -10000000000000000000000000);
 
+INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,
+                           decimalcol, doublecol, floatcol, textcol,
+                           timestampcol, uuidcol, varcharcol, varintcol)
+VALUES (4, '', '', '', '', '', '', '', '', '', '', '', '', '');
 
 
 CREATE TABLE has_value_encoding_errors (