You can read all lines with a lean call to get_range_slices. Note that it returns rows in marker order, not in key order. So itβs great to read all the lines, but not do the ranges between the line keys.
You can use it in Astyanax with getAllRows (). Here is a sample code (copied from documents at https://github.com/Netflix/astyanax/wiki/Reading-Data#iterate-all-rows-in-a-column-family )
Rows<String, String>> rows; try { rows = keyspace.prepareQuery("ColumnFamilyName") .getAllRows() .setBlockSize(10) .withColumnRange(new RangeBuilder().setMaxSize(10).build()) .setExceptionCallback(new ExceptionCallback() { @Override public boolean onException(ConnectionException e) { try { Thread.sleep(1000); } catch (InterruptedException e1) { } return true; }}) .execute().getResult(); } catch (ConnectionException e) { }
This will return the first 10 columns of each row in batches of 10 rows. Increase the number passed to RangeBuilder (). SetMaxSize to get more (or fewer) columns.
source share