byte[] start = null; byte[] lastEnd = null; int count = 0; while (true) { RangeSlicesQuerychange the UUID identify. Put byte[]rsq = HFactory .createRangeSlicesQuery(keyspaceOperator, me.prettyprint.cassandra.serializers.BytesArraySerializer.get(), StringSerializer.get(), StringSerializer.get()); rsq.setColumnFamily("columnFamily"); rsq.setColumnNames("uuid","idUser","timestamp","urlPageVisited","processed"); rsq.setKeys(start, null); rsq.setReturnKeysOnly(); // Return column names instead of values rsq.setRowCount(3); // Arbitrary default OrderedRows rows = rsq.execute().get(); int rowCount = rows.getCount(); if (rowCount == 0) { break; } else { start = rows.peekLast().getKey(); if (lastEnd != null && Arrays.equals(start,lastEnd) ) { // modify this line break; } count += rowCount - 1; lastEnd = start; } if (count > 0) { count += 1; } System.out.print("count de la tabla " + count); return count; }
Tuesday, October 30, 2012
Cassandra keys in Unix/linux server and client in java windows
In this
link talk about to count in rows in cassandra. But there a little problem when Unix database and client java Windows. The serialize UUID dont work.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment