java driver 4.6.1 seems incompatible with 3.7 when it comes to QueryBuilder.update() and incrementing counter columns
I'm using the java driver version 4.6.1 and a cassandra cluster running version 3.7
I'm trying to build a query using the builder, like this.
SimpleStatement incrementEnrollmentStageStatement = update("some_table") .increment("a_counter_column") .whereColumn("the_primary_key").isEqualTo(bindMarker()) .build();
The resulting CQL looks like this
UPDATE some_table SET a_counter_column+=1 WHERE the_primary_key=?
but trying to prepare this throwns an error, so does cqlsh if I try to run it.
line 1:39 no viable alternative at input '+'
In fact, "+=" increments aren't supported in 3.7, but are in 4.0.
Is this a bug? Am I doing anything wrong? This seems like the obvious way to do this.
I realize that append() works but looking at the javadocs for it says
Appends to a collection column, as in SET l=l+?.
As it works I'm fine but isn't this confusing? Perhaps the driver should identify older versions of cassandra and make increment work for those.
Thanks.