You would have to perform a SELECT on the row in the trigger code in order to determine if there was underlying data. Cassandra is in essence an append-only data store, when an INSERT or UPDATE is executed, it has no idea if there is already a row underlying it, and for write performance reasons it also doesn't care.
Note that if you do this, you're going to introduce a giant bottleneck in your write path and increase the IO cost of writes. You'll also probably have some race conditions such that if two writes to the same row happen in quick succession your trigger might not notice that one of them is writing to the same row as the other. You might need to resort to CAS operations to overcome that, along with its associated overhead. But all that said, it should be possible, though you'll have to write it for yourself in your trigger code. On Tue, Oct 4, 2016 at 12:29 PM Kant Kodali <k...@peernova.com> wrote: > Hi all, > > How to write a trigger in Cassandra to detect updates? My requirement is > that I want a trigger to alert me only when there is an update to an > existing row and looks like given the way INSERT and Update works this > might be hard to do because INSERT will just overwrite if there is an > existing row and Update becomes new insert where there is no row that > belongs to certain partition key. is there a way to solve this problem? > > Thanks, > > kant >