Benjamin Shen created CASSANDRA-13927:
-----------------------------------------

             Summary: cqlsh 3.11.0 fails to correctly format nulls within 
collections
                 Key: CASSANDRA-13927
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13927
             Project: Cassandra
          Issue Type: Bug
          Components: Tools
            Reporter: Benjamin Shen
            Priority: Minor


When attempting to format null String fields (ascii, text, varchar), cqlsh will 
fail with the following error:
{code}
Connected to Test Cluster at X.X.X.X:9042.
[cqlsh 5.0.1 | Cassandra 3.11.0 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh:my_keyspace> CREATE TABLE test_tuples(a int PRIMARY KEY, b tuple<ascii>);
cqlsh:my_keyspace> INSERT INTO test_tuples (a, b) VALUES (1, (NULL));
cqlsh:my_keyspace> SELECT * FROM test_tuples ;

 a | b
---+---------
 1 | (None,)

(1 rows)
Failed to format value (None,) : 'NoneType' object has no attribute 'replace'
cqlsh:my_keyspace> {code}

A similar formatting *error* occurs for the following types when placed into 
collections:
- blob
- double
- float
- frozen<list<int>>
- frozen<map<int, int>>
- frozen<set<int>>
- frozen<tuple<int>>
- list<int>
- map<int, int>
- set<int>
- tuple<int>

In addition, the following types produce *incorrect* formatting, but without 
error, when null values are placed into collections:
{code}cqlsh:my_keyspace> CREATE TABLE test_tuple2(a int PRIMARY KEY, b 
tuple<bigint, boolean, date, decimal, inet, int, smallint, time, timestamp, 
timeuuid, tinyint, uuid, varint>);
cqlsh:my_keyspace> INSERT INTO test_tuple2 (a, b) VALUES (1, (NULL, NULL, NULL, 
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL));
cqlsh:my_keyspace> SELECT * FROM test_tuple2;

 a | b
---+------------------------------------------------------------------------------------
 1 | (None, None, None, None, 'None', None, None, None, 'None', None, None, 
None, None)

(1 rows)
cqlsh:my_keyspace>{code}

As you can see, we receive "{{None}}" or "{{'None'}}" instead of the expected 
"{{null}}".



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to