Package org.apache.cassandra.db.filter
Class DataLimits
java.lang.Object
org.apache.cassandra.db.filter.DataLimits
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 ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DataLimitsstatic final intstatic final DataLimitsstatic final DataLimits.Serializer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intcount()The max number of results this limits enforces.static DataLimitscqlLimits(int cqlRowLimit) static DataLimitscqlLimits(int cqlRowLimit, int perPartitionLimit) static DataLimitsdistinctLimits(int cqlRowLimit) abstract floatEstimate the number of results that a full scan of the provided cfs would yield.filter(PartitionIterator iter, long nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) filter(UnfilteredPartitionIterator iter, long nowInSec, boolean countPartitionsWithOnlyStaticData) filter(UnfilteredRowIterator iter, long nowInSec, boolean countPartitionsWithOnlyStaticData) Creates aDataLimitsinstance to be used for paginating internally GROUP BY queries.abstract DataLimitsforPaging(int pageSize) abstract DataLimitsforPaging(int pageSize, ByteBuffer lastReturnedKey, int lastReturnedKeyRemaining) abstract DataLimitsforShortReadRetry(int toFetch) static DataLimitsgroupByLimits(int groupLimit, int groupPerPartitionLimit, int rowLimit, AggregationSpecification groupBySpec) abstract booleanhasEnoughLiveData(CachedPartition cached, long nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) abstract booleanbooleanisExhausted(DataLimits.Counter counter) booleanabstract booleanabstract DataLimits.Kindkind()abstract DataLimits.CounternewCounter(long nowInSec, boolean assumeLiveData, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) Returns a newCounterfor this limits.abstract intabstract DataLimitsReturns equivalent limits but where any internal state kept to track where we are of paging and/or grouping is discarded.
-
Field Details
-
serializer
-
NO_LIMIT
public static final int NO_LIMIT- See Also:
-
NONE
-
DISTINCT_NONE
-
-
Constructor Details
-
DataLimits
public DataLimits()
-
-
Method Details
-
cqlLimits
-
cqlLimits
-
groupByLimits
public static DataLimits groupByLimits(int groupLimit, int groupPerPartitionLimit, int rowLimit, AggregationSpecification groupBySpec) -
distinctLimits
-
kind
-
isUnlimited
public abstract boolean isUnlimited() -
isDistinct
public abstract boolean isDistinct() -
isGroupByLimit
public boolean isGroupByLimit() -
isExhausted
-
forPaging
-
forPaging
public abstract DataLimits forPaging(int pageSize, ByteBuffer lastReturnedKey, int lastReturnedKeyRemaining) -
forShortReadRetry
-
forGroupByInternalPaging
Creates aDataLimitsinstance to be used for paginating internally GROUP BY queries.- Parameters:
state- theGroupMakerstate- Returns:
- a
DataLimitsinstance to be used for paginating internally GROUP BY queries
-
hasEnoughLiveData
public abstract boolean hasEnoughLiveData(CachedPartition cached, long nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) -
newCounter
public abstract DataLimits.Counter newCounter(long nowInSec, boolean assumeLiveData, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) Returns a newCounterfor 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 betruewhen used on aRowIterator(since it only returns live rows), false otherwise.countPartitionsWithOnlyStaticData- iftruethe 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
Counterfor 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
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, long nowInSec, boolean countPartitionsWithOnlyStaticData) -
filter
public UnfilteredRowIterator filter(UnfilteredRowIterator iter, long nowInSec, boolean countPartitionsWithOnlyStaticData) -
filter
public PartitionIterator filter(PartitionIterator iter, long nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) -
estimateTotalResults
Estimate the number of results that a full scan of the provided cfs would yield.
-