Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-13927

cqlsh 3.11.0 fails to correctly format nulls within collections

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Legacy/Tools
    • Labels:
    • Severity:
      Low

      Description

      When attempting to format null String fields (ascii, text, varchar), cqlsh will fail with the following error:

      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> 

      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:

      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>

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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bshen Benjamin Shen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: