1

I understood a counter family could have keys of any kind. Are composite keys unsupported?

 cqlsh:goh_master> create columnfamily balance (kind ascii, corporation_id ascii, amount  counter, primary key ( kind,corporation_id) ) with compact storage;
 cqlsh:goh_master> insert into balance(kind,corporation_id,amount) values ('c',103,123456789);
 Bad Request: invalid operation for commutative columnfamily balance
 cqlsh:goh_master> create columnfamily balance (kind ascii, corporation_id ascii, amount counter, primary key ( kind,corporation_id) ) with compact storage;
 cqlsh:goh_master> insert into balance(kind,corporation_id,amount) values ('c',103,123456789);
 Bad Request: invalid operation for commutative columnfamily balance
Alar
  • 760
  • 4
  • 11

1 Answers1

1

I solved it by myself thanks to this answer. You cant insert into counters nor just set. You must always use set counter =counter +n syntax:

cqlsh:goh_master> update balance set amount=amount+12 where kind='c' and corporation_id = 103;

worked like a charm

Community
  • 1
  • 1
Alar
  • 760
  • 4
  • 11