1

I need to generate auto increment id in a column in sequence manner in Cassandra from Spark using Java.

Can somebody help on this?

techraf
  • 64,883
  • 27
  • 193
  • 198
Aman
  • 41
  • 2
  • 8
  • If you mean a column with an id incremented for each row inserted like mysql (and others) do, i am afraid this feature is not available in Cassandra. – Thomas Arnaud Oct 17 '16 at 10:09
  • I mean the same.... Thanks. So is there any other way to do it? – Aman Oct 17 '16 at 10:31
  • If you need a unique value, I recommend using a uuid or timeuuid field. You can populate the later with the now() value. – medvekoma Oct 17 '16 at 15:30
  • would it be in a sequence? @medvekoma – Aman Oct 17 '16 at 17:59
  • Possible duplicate of [Should we use Cassandra NoSQL counter or LWT for auto incremental integer key generation?](http://stackoverflow.com/questions/27987216/should-we-use-cassandra-nosql-counter-or-lwt-for-auto-incremental-integer-key-ge) – Brad Schoening Oct 18 '16 at 03:54
  • @Aman, yes, the now() function returns a timeuuid, which is a unique timestamp. – medvekoma Oct 18 '16 at 07:20

0 Answers0