[ https://issues.apache.org/jira/browse/CASSANDRA-5675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13694218#comment-13694218 ]
Brandon Williams commented on CASSANDRA-5675: --------------------------------------------- +1 > 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 > Assignee: Aleksey Yeschenko > Priority: Minor > Labels: cqlsh > Fix For: 1.2.7 > > Attachments: 5675.txt > > > 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