Class 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.
    • Constructor Detail

      • DataLimits

        public DataLimits()
    • Method Detail

      • cqlLimits

        public static DataLimits cqlLimits​(int cqlRowLimit)
      • cqlLimits

        public static DataLimits cqlLimits​(int cqlRowLimit,
                                           int perPartitionLimit)
      • distinctLimits

        public static DataLimits distinctLimits​(int cqlRowLimit)
      • isUnlimited

        public abstract boolean isUnlimited()
      • isDistinct

        public abstract boolean isDistinct()
      • isGroupByLimit

        public boolean isGroupByLimit()
      • 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 a DataLimits instance to be used for paginating internally GROUP BY queries.
        Parameters:
        state - the GroupMaker 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 new Counter 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 be true when used on a RowIterator (since it only returns live rows), false otherwise.
        countPartitionsWithOnlyStaticData - if true 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 from TableMetadata.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.
      • estimateTotalResults

        public abstract float estimateTotalResults​(ColumnFamilyStore cfs)
        Estimate the number of results that a full scan of the provided cfs would yield.