DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

bb.addagada_90355 avatar image
bb.addagada_90355 asked ·

How can I add blank values instead of null values in cassandra ?

We are using DSE 5.1.0 & Spring boot Java.

While we are trying to insert data into cassandra , java by default inserts null values in cassandra tables which is causing huge tombstones.


Instead of changing code in java to insert null values, can you control anywhere at driver level ?

cassandra tombstones
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

seandurity_18889 avatar image
seandurity_18889 answered ·

Beware of CQL generators, like Spring Data Cassandra. The more proper insert is to only insert columns that have values. I think the null generation is in the Spring Data framework, not Java.

Good: insert into my_table (key, columna, columnb) values ('my_id','text A','text B');

--don't include columnc, columnd if there are no values. Nulls create tombstones and will delete any values previously inserted for those columns

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.