java - Astyanax cql3 COUNT query returning ROWS not NUMBER -
according example page of astyanax:
https://github.com/netflix/astyanax/wiki/cql-and-cql3
when run count
query, result
returns "number", can query with:
try { operationresult<cqlresult<string, string>> result = keyspace.preparequery(cf_standard1) .withcql("select count(*) standard1 key='a';") .execute(); system.out.println("cql count: " + result.getresult().getnumber()); } catch (connectionexception e) { }
and should give count
result, querying table cql3 , isn't giving me "number", "rows", 1 row , 1 column.
the method hasnumber
gives false
, method hasrows
gives true
, now, how can result of count
query?
you should use
system.out.println("cql count: " + result.getresult().getrows().getrowbyindex(0).getcolumns().getcolumnbyname("count").getlongvalue());
Comments
Post a Comment