public final class AggregationQueryPager extends java.lang.Object implements QueryPager
QueryPager
that takes care of fetching the pages for aggregation queries.
For aggregation/group by queries, the user page size is in number of groups. But each group could be composed of very
many rows so to avoid running into OOMs, this pager will page internal queries into sub-pages. So each call to
fetchPage
may (transparently) yield multiple internal queries (sub-pages).
Modifier and Type | Class and Description |
---|---|
class |
AggregationQueryPager.AggregationPartitionIterator
PartitionIterator for queries without Group By but with aggregates. |
class |
AggregationQueryPager.GroupByPartitionIterator
PartitionIterator that automatically fetch a new sub-page of data if needed when the current iterator is
exhausted. |
EMPTY
Constructor and Description |
---|
AggregationQueryPager(QueryPager subPager,
DataLimits limits) |
Modifier and Type | Method and Description |
---|---|
ReadExecutionController |
executionController()
Starts a new read operation.
|
PartitionIterator |
fetchPage(int pageSize,
ConsistencyLevel consistency,
ClientState clientState,
long queryStartNanoTime)
Fetches the next page.
|
PartitionIterator |
fetchPageInternal(int pageSize,
ReadExecutionController executionController)
Fetches the next page internally (in other, this does a local query).
|
boolean |
isExhausted()
Whether or not this pager is exhausted, i.e.
|
int |
maxRemaining()
The maximum number of cells/CQL3 row that we may still have to return.
|
PagingState |
state()
Get the current state of the pager.
|
QueryPager |
withUpdatedLimit(DataLimits newLimits)
Creates a new
QueryPager that use the new limits. |
public AggregationQueryPager(QueryPager subPager, DataLimits limits)
public PartitionIterator fetchPage(int pageSize, ConsistencyLevel consistency, ClientState clientState, long queryStartNanoTime)
QueryPager
fetchPage
in interface QueryPager
pageSize
- the maximum number of elements to return in the next page.consistency
- the consistency level to achieve for the query.clientState
- the ClientState
for the query. In practice, this can be null unless
consistency
is a serial consistency.public ReadExecutionController executionController()
QueryPager
This must be called before fetchPageInternal
and passed to it to protect the read.
The returned object must be closed on all path and it is thus strongly advised to
use it in a try-with-ressource construction.
executionController
in interface QueryPager
QueryPager
.public PartitionIterator fetchPageInternal(int pageSize, ReadExecutionController executionController)
QueryPager
fetchPageInternal
in interface QueryPager
pageSize
- the maximum number of elements to return in the next page.executionController
- the ReadExecutionController
protecting the read.public boolean isExhausted()
QueryPager
isExhausted
in interface QueryPager
public int maxRemaining()
QueryPager
maxRemaining
in interface QueryPager
public PagingState state()
QueryPager
state
in interface QueryPager
public QueryPager withUpdatedLimit(DataLimits newLimits)
QueryPager
QueryPager
that use the new limits.withUpdatedLimit
in interface QueryPager
newLimits
- the new limitsQueryPager
that use the new limitsCopyright © 2009-2021 The Apache Software Foundation