Package org.apache.cassandra.db.filter
Class DataLimits
- java.lang.Object
-
- org.apache.cassandra.db.filter.DataLimits
-
public abstract class DataLimits extends java.lang.Object
Object in charge of tracking if we have fetch enough data for a given query. This is more complicated than a single count because we support PER PARTITION limits, but also due to GROUP BY and paging.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DataLimits.Counter
static class
DataLimits.Kind
static class
DataLimits.Serializer
-
Field Summary
Fields Modifier and Type Field Description static DataLimits
DISTINCT_NONE
static int
NO_LIMIT
static DataLimits
NONE
static DataLimits.Serializer
serializer
-
Constructor Summary
Constructors Constructor Description DataLimits()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
count()
The max number of results this limits enforces.static DataLimits
cqlLimits(int cqlRowLimit)
static DataLimits
cqlLimits(int cqlRowLimit, int perPartitionLimit)
static DataLimits
distinctLimits(int cqlRowLimit)
abstract float
estimateTotalResults(ColumnFamilyStore cfs)
Estimate the number of results that a full scan of the provided cfs would yield.PartitionIterator
filter(PartitionIterator iter, int nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness)
UnfilteredPartitionIterator
filter(UnfilteredPartitionIterator iter, int nowInSec, boolean countPartitionsWithOnlyStaticData)
UnfilteredRowIterator
filter(UnfilteredRowIterator iter, int nowInSec, boolean countPartitionsWithOnlyStaticData)
DataLimits
forGroupByInternalPaging(GroupingState state)
Creates aDataLimits
instance to be used for paginating internally GROUP BY queries.abstract DataLimits
forPaging(int pageSize)
abstract DataLimits
forPaging(int pageSize, java.nio.ByteBuffer lastReturnedKey, int lastReturnedKeyRemaining)
abstract DataLimits
forShortReadRetry(int toFetch)
static DataLimits
groupByLimits(int groupLimit, int groupPerPartitionLimit, int rowLimit, AggregationSpecification groupBySpec)
abstract boolean
hasEnoughLiveData(CachedPartition cached, int nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness)
abstract boolean
isDistinct()
boolean
isExhausted(DataLimits.Counter counter)
boolean
isGroupByLimit()
abstract boolean
isUnlimited()
abstract DataLimits.Kind
kind()
abstract DataLimits.Counter
newCounter(int nowInSec, boolean assumeLiveData, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness)
Returns a newCounter
for this limits.abstract int
perPartitionCount()
abstract DataLimits
withoutState()
Returns equivalent limits but where any internal state kept to track where we are of paging and/or grouping is discarded.
-
-
-
Field Detail
-
serializer
public static final DataLimits.Serializer serializer
-
NO_LIMIT
public static final int NO_LIMIT
- See Also:
- Constant Field Values
-
NONE
public static final DataLimits NONE
-
DISTINCT_NONE
public static final DataLimits DISTINCT_NONE
-
-
Method Detail
-
cqlLimits
public static DataLimits cqlLimits(int cqlRowLimit)
-
cqlLimits
public static DataLimits cqlLimits(int cqlRowLimit, int perPartitionLimit)
-
groupByLimits
public static DataLimits groupByLimits(int groupLimit, int groupPerPartitionLimit, int rowLimit, AggregationSpecification groupBySpec)
-
distinctLimits
public static DataLimits distinctLimits(int cqlRowLimit)
-
kind
public abstract DataLimits.Kind kind()
-
isUnlimited
public abstract boolean isUnlimited()
-
isDistinct
public abstract boolean isDistinct()
-
isGroupByLimit
public boolean isGroupByLimit()
-
isExhausted
public boolean isExhausted(DataLimits.Counter counter)
-
forPaging
public abstract DataLimits forPaging(int pageSize)
-
forPaging
public abstract DataLimits forPaging(int pageSize, java.nio.ByteBuffer lastReturnedKey, int lastReturnedKeyRemaining)
-
forShortReadRetry
public abstract DataLimits forShortReadRetry(int toFetch)
-
forGroupByInternalPaging
public DataLimits forGroupByInternalPaging(GroupingState state)
Creates aDataLimits
instance to be used for paginating internally GROUP BY queries.- Parameters:
state
- theGroupMaker
state- Returns:
- a
DataLimits
instance to be used for paginating internally GROUP BY queries
-
hasEnoughLiveData
public abstract boolean hasEnoughLiveData(CachedPartition cached, int nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness)
-
newCounter
public abstract DataLimits.Counter newCounter(int nowInSec, boolean assumeLiveData, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness)
Returns a newCounter
for this limits.- Parameters:
nowInSec
- the current time in second (to decide what is expired or not).assumeLiveData
- if true, the counter will assume that every row passed is live and won't thus check for liveness, otherwise it will. This should betrue
when used on aRowIterator
(since it only returns live rows), false otherwise.countPartitionsWithOnlyStaticData
- iftrue
the partitions with only static data should be counted as 1 valid row.enforceStrictLiveness
- whether the row should be purged if there is no PK liveness info, normally retrieved fromTableMetadata.enforceStrictLiveness()
- Returns:
- a new
Counter
for this limits.
-
count
public abstract int count()
The max number of results this limits enforces.Note that the actual definition of "results" depends a bit: for "normal" queries it's a number of rows, but for GROUP BY queries it's a number of groups.
- Returns:
- the maximum number of results this limits enforces.
-
perPartitionCount
public abstract int perPartitionCount()
-
withoutState
public abstract DataLimits withoutState()
Returns equivalent limits but where any internal state kept to track where we are of paging and/or grouping is discarded.
-
filter
public UnfilteredPartitionIterator filter(UnfilteredPartitionIterator iter, int nowInSec, boolean countPartitionsWithOnlyStaticData)
-
filter
public UnfilteredRowIterator filter(UnfilteredRowIterator iter, int nowInSec, boolean countPartitionsWithOnlyStaticData)
-
filter
public PartitionIterator filter(PartitionIterator iter, int nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness)
-
estimateTotalResults
public abstract float estimateTotalResults(ColumnFamilyStore cfs)
Estimate the number of results that a full scan of the provided cfs would yield.
-
-