Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

imarkiew avatar image
imarkiew asked imarkiew commented

The writeTo function updates counters improperly

I'd like to set a counter's value using connector's API. I tried to use the writeTo function, but it seems that the inserted value is incremented by one in comparison to what one would expect (exactly the same value as in a Dataframe).

spark-cassandra-connector
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered imarkiew commented

If you're trying to set the value of a counter column, it will not work because the only valid operations are increment or decrement.

If I misunderstood your question, please feel free to update the description of your original question above and provide:

  1. sample code that replicates the issue,
  2. version of Spark connector you're using,
  3. Cassandra version of the cluster you're connecting to.

Cheers!

1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Hello, thank you for the answer.
After further investigation I discovered a nasty bug on my side (duplicated values). There's no problem with the writeTo function and the topic can be closed.

0 Likes 0 ·