问题
I have a CSV file in the following format
key1,key2,key3,counter1,counter2,counter3,counter4
1,2,1,0,0,0,1
1,2,2,0,1,0,4
The CQL3 table has all value columns of type 'counter'. When I try to use the COPY command to load the CSV I get the usual error which asks for an UPDATE instead of an INSERT.
The question is : how can I tell CQL to use an UPDATE ?
Is there any other way to do this ?
回答1:
using sstables solved this issue. Although a little slower than what i expected , it does the job
回答2:
To update a counter column you have to delete it (with Consistency set to ALL) and then insert a new value (same consistency).
So my advice is to use an HashMap in you program and determine which value you want to write to the counter column (oldest, highest, lowest, ...).
来源:https://stackoverflow.com/questions/21112166/how-can-a-csv-file-with-counter-columns-be-loaded-to-a-cassandra-cql3-table