DataLimits (apache-cassandra API)
Date: 2018-02-14

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. The reason this is not just a simple integer is that Thrift and CQL3 count stuffs in different ways. This is what abstract those differences.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DataLimits.Counter`
    `static class` | `DataLimits.Kind`
    `static class` | `DataLimits.Serializer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static DataLimits` | `DISTINCT_NONE`
    `static int` | `NO_LIMIT`
    `static DataLimits` | `NONE`
    `static DataLimits.Serializer` | `serializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataLimits()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and 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 (the definition of "results" will be rows for CQL queries and partitions for thrift ones) 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 a `DataLimits` 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 new `Counter` for this limits.
    `abstract int` | `perPartitionCount()`
    `static DataLimits` | `superColumnCountingLimits(int partitionLimit, int cellPerPartitionLimit)`
    `static DataLimits` | `thriftLimits(int partitionLimit, int cellPerPartitionLimit)`
    `abstract DataLimits` | `withoutState()` Returns equivalent limits but where any internal state kept to track where we are of paging and/or grouping is discarded.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

  - ### Constructor Detail

    - #### DataLimits

          public DataLimits()

  - ### 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)

    - #### thriftLimits

          public static DataLimits thriftLimits(int partitionLimit,
                                                int cellPerPartitionLimit)

    - #### superColumnCountingLimits

          public static DataLimits superColumnCountingLimits(int partitionLimit,
                                                             int cellPerPartitionLimit)

    - #### 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 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 `CFMetaData.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 CQL, it's always rows, but for thrift, it means cells.

      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 (the definition of "results" will be rows for CQL queries and partitions for thrift ones) that a full scan of the provided cfs would yield.

Copyright © 2018 The Apache Software Foundation