You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2013/06/20 12:37:20 UTC

[jira] [Created] (CASSANDRA-5675) cqlsh shouldn't display "null" for empty values

Sylvain Lebresne created CASSANDRA-5675:
-------------------------------------------

             Summary: cqlsh shouldn't display "null" for empty values
                 Key: CASSANDRA-5675
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5675
             Project: Cassandra
          Issue Type: Bug
            Reporter: Sylvain Lebresne
            Priority: Minor
             Fix For: 1.2.7


For historical reason (and compatibility with thrift), all type support an empty value, even type like int for which it doesn't really make sense (see CASSANDRA-5674 too on that subject).

If you input such an empty value for a type like int, cqlsh will display it as null:
{noformat}
cqlsh:ks> CREATE TABLE test (k text PRIMARY KEY, v int);
cqlsh:ks> INSERT INTO test(k, v) VALUES ('someKey', blobAsInt(0x));
cqlsh:ks> SELECT * FROM test;

 k       | v
---------+------
 someKey | null

{noformat} 

But that's not correct, it suggests {{v}} has no value but that's not true, it has a value, it's just an empty one.

Now, one may argue support empty values for a type like int is broken, and I would agree with that. But thrift allows it so we probably need to preserve that behavior for compatibility sake. And I guess the need to use blobAsInt at least make it clear that it's kind of a hack.

That being said, cqlsh should not display null as this is confusing. Instead I'd suggest either displaying nothing (that's how an empty string is displayed after all), or to just go with some random explicit syntax like say "[empty value]"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira