@Test public void testPartialIterateColumns() throws IOException { final Random random = new Random(); final Array<Tuple2<ByteBuffer, Array<Tuple2<ByteBuffer, ByteBuffer>>>> keysMap = generateRandomKeysMap(); final ResultSet resultSet = generateMockedResultSet(keysMap); final CQLColValGetter getter = new CQLColValGetter(new EntryMetaData[0]); try (final CQLResultSetKeyIterator resultSetKeyIterator = new CQLResultSetKeyIterator(ALL_COLUMNS, getter, resultSet)) { final Iterator<Tuple2<ByteBuffer, Array<Tuple2<ByteBuffer, ByteBuffer>>>> iterator = keysMap.iterator(); while (resultSetKeyIterator.hasNext()) { final StaticBuffer next = resultSetKeyIterator.next(); try (final RecordIterator<Entry> entries = resultSetKeyIterator.getEntries()) { final Tuple2<ByteBuffer, Array<Tuple2<ByteBuffer, ByteBuffer>>> current = iterator.next(); final ByteBuffer currentKey = current._1; final Array<Tuple2<ByteBuffer, ByteBuffer>> columnValues = current._2; final Iterator<Tuple2<ByteBuffer, ByteBuffer>> columnIterator = columnValues.iterator(); while (entries.hasNext()) { final Entry entry = entries.next(); final Tuple2<ByteBuffer, ByteBuffer> columnAndValue = columnIterator.next(); assertEquals(currentKey, next.asByteBuffer()); assertEquals(columnAndValue._1, entry.getColumn().asByteBuffer()); assertEquals(columnAndValue._2, entry.getValue().asByteBuffer()); assertEquals(columnIterator.hasNext(), entries.hasNext()); if (random.nextInt(10) == 0) { break; } } } } } }
@Override public RecordIterator<Entry> getEntries() { return new EntryRecordIterator(this.sliceQuery, this.getter, Iterator.of(this.currentRow).concat(this.iterator), this.currentKey); }
CQLResultSetKeyIterator extends AbstractIterator<StaticBuffer> implements KeyIterator { @Override public RecordIterator<Entry> getEntries() { return new EntryRecordIterator(this.sliceQuery, this.getter, Iterator.of(this.currentRow).concat(this.iterator), this.currentKey); } }
CQLResultSetKeyIterator extends AbstractIterator<StaticBuffer> implements KeyIterator { @Override public RecordIterator<Entry> getEntries() { return new EntryRecordIterator(this.sliceQuery, this.getter, Iterator.of(this.currentRow).concat(this.iterator), this.currentKey); } CQLResultSetKeyIterator(final SliceQuery sliceQuery, final CQLColValGetter getter, final Iterable<Row> resultSet); }
CQLResultSetKeyIterator extends AbstractIterator<StaticBuffer> implements KeyIterator { @Override public RecordIterator<Entry> getEntries() { return new EntryRecordIterator(this.sliceQuery, this.getter, Iterator.of(this.currentRow).concat(this.iterator), this.currentKey); } CQLResultSetKeyIterator(final SliceQuery sliceQuery, final CQLColValGetter getter, final Iterable<Row> resultSet); @Override RecordIterator<Entry> getEntries(); @Override void close(); }
CQLResultSetKeyIterator extends AbstractIterator<StaticBuffer> implements KeyIterator { @Override public RecordIterator<Entry> getEntries() { return new EntryRecordIterator(this.sliceQuery, this.getter, Iterator.of(this.currentRow).concat(this.iterator), this.currentKey); } CQLResultSetKeyIterator(final SliceQuery sliceQuery, final CQLColValGetter getter, final Iterable<Row> resultSet); @Override RecordIterator<Entry> getEntries(); @Override void close();  }