2014-04-02 11 views

답변

9

내게는 입니다.

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()); 
    } 
} 
0

당신은 당신의 스칼라 태그에 따라, 스칼라에서 할 수있는 방법을

val query = HFactory.createMultigetSliceCounterQuery(keyspaceName, se, se) 
    query.setColumnFamily("counterFamily").setKeys(list).setRange(null, null, false,3) 
    val resultRows = query.execute().get 
    resultRows.map{row=> 
     var countStatus = new scala.collection.immutable.HashMap[S, S]() 
     row.getColumnSlice.getColumns.map{col=> 
     countStatus += (col.getName -> col.getValue) 
     } 
     println(row.getKey -> countStatus) 
    }