public boolean isExhausted() { if (remaining <= 0 || pagers == null) return true; while (current < pagers.length) { if (!pagers[current].isExhausted()) return false; current++; } return true; }
public PagingState state() { // Sets current to the first non-exhausted pager if (isExhausted()) return null; PagingState state = pagers[current].state(); return new PagingState(pagers[current].key(), state == null ? null : state.rowMark, remaining, pagers[current].remainingInPartition()); }
@Override public SinglePartitionPager withUpdatedLimit(DataLimits newLimits) { return new SinglePartitionPager(command.withUpdatedLimit(newLimits), protocolVersion, lastReturned, maxRemaining(), remainingInPartition()); }
public PagingState state() { return lastReturned == null ? null : new PagingState(null, lastReturned, maxRemaining(), remainingInPartition()); }
protected RowIterator computeNext() { while (result == null || !result.hasNext()) { if (result != null) { result.close(); counted += pagerMaxRemaining - pagers[current].maxRemaining(); } // We are done if we have reached the page size or in the case of GROUP BY if the current pager // is not exhausted. boolean isDone = counted >= pageSize || (result != null && limit.isGroupByLimit() && !pagers[current].isExhausted()); // isExhausted() will sets us on the first non-exhausted pager if (isDone || isExhausted()) { closed = true; return endOfData(); } pagerMaxRemaining = pagers[current].maxRemaining(); int toQuery = pageSize - counted; result = consistency == null ? pagers[current].fetchPageInternal(toQuery, executionController) : pagers[current].fetchPage(toQuery, consistency, clientState, queryStartNanoTime); } return result.next(); }
final SinglePartitionPager pager = new SinglePartitionPager(command, null, ProtocolVersion.CURRENT); while (!pager.isExhausted()) try (PartitionIterator iter = pager.fetchPage(pageSize, consistencyLevel, state, queryStartNanoTime))
protected ReadCommand nextPageReadCommand(int pageSize) { Clustering clustering = lastReturned == null ? null : lastReturned.clustering(command.metadata()); DataLimits limits = (lastReturned == null || command.isForThrift()) ? limits().forPaging(pageSize) : limits().forPaging(pageSize, key(), remainingInPartition()); return command.forPaging(clustering, limits); }
boolean readStatic = false; SinglePartitionPager pager = new SinglePartitionPager(cmd, null, ProtocolVersion.CURRENT); while (!pager.isExhausted()) UnfilteredPartitionIterator page = pager.fetchPageUnfiltered(baseCfs.metadata, pageSize, controller))
public List<Row> fetchPage(int pageSize) throws RequestValidationException, RequestExecutionException { List<Row> result = new ArrayList<Row>(); int remainingThisQuery = Math.min(remaining, pageSize); while (remainingThisQuery > 0 && !isExhausted()) { // isExhausted has set us on the first non-exhausted pager List<Row> page = pagers[current].fetchPage(remainingThisQuery); if (page.isEmpty()) continue; Row row = page.get(0); int fetched = pagers[current].columnCounter().countAll(row.cf).live(); remaining -= fetched; remainingThisQuery -= fetched; result.add(row); } return result; }
public ReadExecutionController executionController() { // Note that for all pagers, the only difference is the partition key to which it applies, so in practice we // can use any of the sub-pager ReadOrderGroup group to protect the whole pager for (int i = current; i < pagers.length; i++) { if (pagers[i] != null) return pagers[i].executionController(); } throw new AssertionError("Shouldn't be called on an exhausted pager"); }
private static SinglePartitionPager getPager(SinglePartitionReadCommand command, PagingState pagingState, ProtocolVersion protocolVersion) { return new SinglePartitionPager(command, pagingState, protocolVersion); }
protected RowIterator computeNext() { while (result == null || !result.hasNext()) { if (result != null) { result.close(); counted += pagerMaxRemaining - pagers[current].maxRemaining(); } // We are done if we have reached the page size or in the case of GROUP BY if the current pager // is not exhausted. boolean isDone = counted >= pageSize || (result != null && limit.isGroupByLimit() && !pagers[current].isExhausted()); // isExhausted() will sets us on the first non-exhausted pager if (isDone || isExhausted()) { closed = true; return endOfData(); } pagerMaxRemaining = pagers[current].maxRemaining(); int toQuery = pageSize - counted; result = consistency == null ? pagers[current].fetchPageInternal(toQuery, executionController) : pagers[current].fetchPage(toQuery, consistency, clientState, queryStartNanoTime); } return result.next(); }
final SinglePartitionPager pager = new SinglePartitionPager(command, null, ProtocolVersion.CURRENT); while (!pager.isExhausted()) try (PartitionIterator iter = pager.fetchPage(pageSize, consistencyLevel, state, queryStartNanoTime))
protected ReadCommand nextPageReadCommand(int pageSize) { Clustering clustering = lastReturned == null ? null : lastReturned.clustering(command.metadata()); DataLimits limits = (lastReturned == null || command.isForThrift()) ? limits().forPaging(pageSize) : limits().forPaging(pageSize, key(), remainingInPartition()); return command.forPaging(clustering, limits); }
boolean readStatic = false; SinglePartitionPager pager = new SinglePartitionPager(cmd, null, ProtocolVersion.CURRENT); while (!pager.isExhausted()) UnfilteredPartitionIterator page = pager.fetchPageUnfiltered(baseCfs.metadata, pageSize, controller))
public PagingState state() { return lastReturned == null ? null : new PagingState(null, lastReturned, maxRemaining(), remainingInPartition()); }
public ReadExecutionController executionController() { // Note that for all pagers, the only difference is the partition key to which it applies, so in practice we // can use any of the sub-pager ReadOrderGroup group to protect the whole pager for (int i = current; i < pagers.length; i++) { if (pagers[i] != null) return pagers[i].executionController(); } throw new AssertionError("Shouldn't be called on an exhausted pager"); }
private static SinglePartitionPager getPager(SinglePartitionReadCommand command, PagingState pagingState, ProtocolVersion protocolVersion) { return new SinglePartitionPager(command, pagingState, protocolVersion); }
protected RowIterator computeNext() { while (result == null || !result.hasNext()) { if (result != null) { result.close(); counted += pagerMaxRemaining - pagers[current].maxRemaining(); } // We are done if we have reached the page size or in the case of GROUP BY if the current pager // is not exhausted. boolean isDone = counted >= pageSize || (result != null && limit.isGroupByLimit() && !pagers[current].isExhausted()); // isExhausted() will sets us on the first non-exhausted pager if (isDone || isExhausted()) { closed = true; return endOfData(); } pagerMaxRemaining = pagers[current].maxRemaining(); int toQuery = pageSize - counted; result = consistency == null ? pagers[current].fetchPageInternal(toQuery, executionController) : pagers[current].fetchPage(toQuery, consistency, clientState, queryStartNanoTime); } return result.next(); }