Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get value from counter Column in cassandra with multiple row keys?

I have one column family that has multiple counter columns. Now I want to get their value behalf of different row keys, Means like RangeSlicesQuery or MultigetSliceQuery, I want to apply on counter column please give me way in counter column.

like image 789
Rohit Sharma Avatar asked Apr 02 '14 09:04

Rohit Sharma


1 Answers

its working for me in java.

MultigetSliceCounterQuery<String, String> query=HFactory.createMultigetSliceCounterQuery(keyspace, se, se);
query.setColumnFamily("MyCounters").setKeys(list).setRange(null, null, false, 3);
CounterRows<String,String> resultRows1 = query.execute().get();

for (CounterRow<String, String> row : resultRows1) {
    System.out.println("Row Key "+ row.getKey());
    for (HCounterColumn<String> col : row.getColumnSlice().getColumns())
        System.out.println("column Name "+col.getName()+"column value "+col.getValue());
    }
}
like image 69
Gabber Avatar answered Oct 16 '22 07:10

Gabber