final ColumnList<C> columns = result.getRow( key ).getColumns();
@Test public void testGetAllKeysRoot() throws ConnectionException { LOG.info("Starting testGetAllKeysRoot..."); List<String> keys = new ArrayList<String>(); for (char key = 'A'; key <= 'Z'; key++) { String keyName = Character.toString(key); keys.add(keyName); } OperationResult<Rows<String, String>> result = keyspace .prepareQuery(CF_STANDARD1) .getKeySlice(keys.toArray(new String[keys.size()])) .execute(); Assert.assertEquals(26, result.getResult().size()); Row<String, String> row; row = result.getResult().getRow("A"); Assert.assertEquals("A", row.getKey()); row = result.getResult().getRow("B"); Assert.assertEquals("B", row.getKey()); row = result.getResult().getRow("NonExistent"); Assert.assertNull(row); row = result.getResult().getRowByIndex(10); Assert.assertEquals("K", row.getKey()); LOG.info("... testGetAllKeysRoot"); }
/** * A single row is present, only parse the single row * @param result * @return */ private List<T> singleRowResult( final Rows<R, C> result ) { if (logger.isTraceEnabled()) logger.trace( "Only a single row has columns. Parsing directly" ); for ( R key : result.getKeys() ) { final ColumnList<C> columnList = result.getRow( key ).getColumns(); final int size = columnList.size(); if ( size > 0 ) { final List<T> results = new ArrayList<>(size); for(Column<C> column: columnList){ results.add(columnParser.parseColumn( column )); } return results; } } //we didn't have any results, just return nothing return Collections.<T>emptyList(); }
final ColumnList<C> columns = result.getRow( key ).getColumns();
/** * Return true if we have < 2 rows with columns, false otherwise */ private boolean containsSingleRowOnly( final Rows<R, C> result ) { int count = 0; for ( R key : result.getKeys() ) { if ( result.getRow( key ).getColumns().size() > 0 ) { count++; //we have more than 1 row with values, return them if ( count > 1 ) { return false; } } } return true; }
result.getRow(rowKey).getColumns().getByteArrayValue(this.options.columnName, null));
Row<Integer, String> row = result.getResult().getRows().getRow(i); Assert.assertTrue(i == row.getKey()); Assert.assertEquals(3, row.getColumns().size());