cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ali Akhtar <ali.rac...@gmail.com>
Subject Re: Inserting null values
Date Wed, 29 Apr 2015 12:27:35 GMT
Have you considered adding a 'toSafe' method which checks if the item is
null, and if so, returns a default value? E.g String too = safe(bar, ""); .
On Apr 29, 2015 3:14 PM, "Matthew Johnson" <matt.johnson@algomi.com> wrote:

> Hi all,
>
>
>
> I have some fields that I am storing into Cassandra, but some of them
> could be null at any given point. As there are quite a lot of them, it
> makes the code much more readable if I don’t check each one for null before
> adding it to the INSERT.
>
>
>
> I can see a few Jiras around CQL 3 supporting inserting nulls:
>
>
>
> https://issues.apache.org/jira/browse/CASSANDRA-3783
>
> https://issues.apache.org/jira/browse/CASSANDRA-5648
>
>
>
> But I have tested inserting null and it seems to work fine (when querying
> the table with cqlsh, it shows up as a red lowercase *null*).
>
>
>
> Are there any obvious pitfalls to look out for that I have missed? Could
> it be a performance concern to insert a row with some nulls, as opposed to
> checking the values first and inserting the row and just omitting those
> columns?
>
>
>
> Thanks!
>
> Matt
>
>
>

Mime
View raw message