Reputation: 2072
I am currently doing a batch insert of 2000 columns across a few rowkeys to cassandra. The way i do this is by using addinsertion
while( cond... ){
myMutator.addInsertion(keyId, columnfamilyName,compositeColumn);
totalCount++;
if(totalCount % 2000 == 0){
myMutator.execute();
}
}
Is there any way to get the number of columns added to the batch without using the totalCount variable. BatchMutation.getSize() returns the number of keys for which the updation are added in the batch. I am wondering what is the use of sizeHint while creating the mutator. I am unable to get much details by looking at the source code of hector. All i can see is it is creating the internal mutationMap and mutList to the number of rows and number of columns respectively.
Upvotes: 0
Views: 383
Reputation: 2072
Looks like hector doesn't keep track of the number of columns. So i am going with the totalcount approach i was using earlier.
Upvotes: 0
Reputation: 8985
BatchMutation
has a getSize() method that will do what you want:
/**
* Return the current size of the underlying map
* @return
*/
public int getSize() {
return mutationMap.size();
}
Upvotes: 1