0

I'm using cassandra as the 3rd party store for Ignite. For persisting data to Ignite I use spring-boots ignite-jpa implementation and my objects often have fields that are not populated and therefore null. Naturally when the data is persisted into cassandra, this creates a null value tombstone(s) and in my case quite many due to the volume of data.

Does anyone know if there is a configuration where I could specify not to set (unset) fields (columns) with null value during insert?

I'm aware that null value in cassandra has a special meaning and that this approach would end up not overriding a column value in case of an update to null. However, I'm not concerned with that case.

What I did so far, was to implement my custom CassandraCacheStoreFactory, but was wandering if there is a simpler way.

  • Contribute this improvement to the existing Ignite + Cassandra integration and it will be added to regular Ignite releases going forward. – dmagda Aug 25 '20 at 15:25

1 Answers1

1

If you insert null value, there is no way on cluster side to tell Cassandra to ignore it.

But on client side, with your driver you can tell it to ignore null values so it won't send it to Cassandra.

Take a look at InsertOptions.InsertOptionsBuilder there is a method that tells the driver to ignore null value : withInsertNulls(boolean insertNulls), I think it fits for your use case :

https://docs.spring.io/spring-data/cassandra/docs/current/api/org/springframework/data/cassandra/core/InsertOptions.InsertOptionsBuilder.html#withInsertNulls-boolean-

Saifallah KETBI
  • 303
  • 1
  • 9
  • 1
    Thanks. Looked at it, but this would work for a direct spring-boot -> cassandra persistence (if I'm not mistaken) . There is actually ignite in between that uses a different mechanism. But good to know. Thanks again. – Michal Mlaticek Aug 26 '20 at 06:15