org.apache.cassandra.db.filter

## Class SliceQueryFilter

- java.lang.Object
- - org.apache.cassandra.db.filter.SliceQueryFilter

All Implemented Interfaces:
  IDiskAtomFilter

Direct Known Subclasses:
  IdentityQueryFilter

    public class SliceQueryFilter
    extends java.lang.Object
    implements IDiskAtomFilter

### Nested Class Summary

Nested Classes
`static class` `SliceQueryFilter.Serializer`

### Field Summary

Fields
`int` `compositesToGroup`
`int` `count`
`static int` `IGNORE_TOMBSTONED_PARTITIONS` A special value for compositesToGroup that indicates that partitioned tombstones should not be included in results or count towards the limit.
`boolean` `reversed`
`ColumnSlice[]` `slices`

### Constructor Summary

Constructors
Constructor and Description
`SliceQueryFilter(ColumnSlice[] slices, boolean reversed, int count)` Constructor that accepts multiple slices.
`SliceQueryFilter(ColumnSlice[] slices, boolean reversed, int count, int compositesToGroup)`
`SliceQueryFilter(ColumnSlice slice, boolean reversed, int count)`
`SliceQueryFilter(ColumnSlice slice, boolean reversed, int count, int compositesToGroup)`
`SliceQueryFilter(Composite start, Composite finish, boolean reversed, int count)`
`SliceQueryFilter(Composite start, Composite finish, boolean reversed, int count, int compositesToGroup)`

### Method Summary

All Methods Instance Methods Concrete Methods
`SliceQueryFilter` `cloneShallow()`
`void` `collectReducedColumns(ColumnFamily container, java.util.Iterator<Cell> reducedColumns, DecoratedKey key, int gcBefore, long now)` collects columns from reducedColumns into returnCF.
`ColumnCounter` `columnCounter(CellNameType comparator, long now)`
`boolean` `countCQL3Rows(CellNameType comparator)`
`Composite` `finish()`
`java.util.Comparator<Cell>` `getColumnComparator(CellNameType comparator)`
`java.util.Iterator<Cell>` `getColumnIterator(ColumnFamily cf)` returns an iterator that returns columns from the given columnFamily matching the Filter criteria in sorted order.
`OnDiskAtomIterator` `getColumnIterator(DecoratedKey key, ColumnFamily cf)`
`int` `getLiveCount(ColumnFamily cf, long now)`
`java.util.Iterator<RangeTombstone>` `getRangeTombstoneIterator(ColumnFamily source)`
`OnDiskAtomIterator` `getSSTableColumnIterator(SSTableReader sstable, DecoratedKey key)` returns an iterator that returns columns from the given SSTable matching the Filter criteria in sorted order.
`OnDiskAtomIterator` `getSSTableColumnIterator(SSTableReader sstable, FileDataInput file, DecoratedKey key, RowIndexEntry indexEntry)` Get an iterator that returns columns from the given SSTable using the opened file matching the Filter criteria in sorted order.
`boolean` `hasStaticSlice(CFMetaData cfm)`
`boolean` `isFullyCoveredBy(ColumnFamily cf, long now)` Whether the provided cf, that is assumed to contain the head of the partition, contains enough data to cover this filter.
`boolean` `isHeadFilter()`
`boolean` `isReversed()`
`int` `lastCounted()`
`int` `lastLive()`
`int` `lastTombstones()`
`boolean` `maySelectPrefix(CType type, Composite prefix)`
`protected boolean` `respectTombstoneThresholds()`
`void` `setStart(Composite start)`
`boolean` `shouldInclude(SSTableReader sstable)`
`Pair<SliceQueryFilter,SliceQueryFilter>` `splitOutStaticSlice(CFMetaData cfm)` Splits this filter into two SliceQueryFilters: one that slices only the static columns, and one that slices the remainder of the normal data.
`Composite` `start()`
`java.lang.String` `toString()`
`ColumnFamily` `trim(ColumnFamily cf, int trimTo, long now)`
`void` `updateColumnsLimit(int newLimit)`
`SliceQueryFilter` `withUpdatedCount(int newCount)`
`SliceQueryFilter` `withUpdatedSlices(ColumnSlice[] newSlices)`
`SliceQueryFilter` `withUpdatedStart(Composite newStart, CFMetaData cfm)`

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

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

### Field Detail

#### IGNORE_TOMBSTONED_PARTITIONS

    public static final int IGNORE_TOMBSTONED_PARTITIONS

A special value for compositesToGroup that indicates that partitioned tombstones should not be included in results or count towards the limit. See CASSANDRA-8490 for more details on why this is needed (and done this way).

See Also:
  Constant Field Values

#### slices

    public final ColumnSlice[] slices

#### reversed

    public final boolean reversed

#### count

    public volatile int count

#### compositesToGroup

    public final int compositesToGroup

### Constructor Detail

#### SliceQueryFilter

    public SliceQueryFilter(Composite start,
                            Composite finish,
                            boolean reversed,
                            int count)

#### SliceQueryFilter

    public SliceQueryFilter(Composite start,
                            Composite finish,
                            boolean reversed,
                            int count,
                            int compositesToGroup)

#### SliceQueryFilter

    public SliceQueryFilter(ColumnSlice slice,
                            boolean reversed,
                            int count)

#### SliceQueryFilter

    public SliceQueryFilter(ColumnSlice slice,
                            boolean reversed,
                            int count,
                            int compositesToGroup)

#### SliceQueryFilter

    public SliceQueryFilter(ColumnSlice[] slices,
                            boolean reversed,
                            int count)

Constructor that accepts multiple slices. All slices are assumed to be in the same direction (forward or reversed).

#### SliceQueryFilter

    public SliceQueryFilter(ColumnSlice[] slices,
                            boolean reversed,
                            int count,
                            int compositesToGroup)

### Method Detail

#### cloneShallow

    public SliceQueryFilter cloneShallow()

Specified by:
  `cloneShallow` in interface `IDiskAtomFilter`

#### withUpdatedCount

    public SliceQueryFilter withUpdatedCount(int newCount)

#### withUpdatedSlices

    public SliceQueryFilter withUpdatedSlices(ColumnSlice[] newSlices)

#### hasStaticSlice

    public boolean hasStaticSlice(CFMetaData cfm)

#### splitOutStaticSlice

    public Pair<SliceQueryFilter,SliceQueryFilter> splitOutStaticSlice(CFMetaData cfm)

Splits this filter into two SliceQueryFilters: one that slices only the static columns, and one that slices the remainder of the normal data. This should only be called when the filter is reversed and the filter is known to cover static columns (through hasStaticSlice()).

Returns:
  a pair of (static, normal) SliceQueryFilters

#### withUpdatedStart

    public SliceQueryFilter withUpdatedStart(Composite newStart,
                                             CFMetaData cfm)

#### getColumnIterator

    public java.util.Iterator<Cell> getColumnIterator(ColumnFamily cf)

Description copied from interface: `IDiskAtomFilter`
returns an iterator that returns columns from the given columnFamily matching the Filter criteria in sorted order.

Specified by:
  `getColumnIterator` in interface `IDiskAtomFilter`

#### getColumnIterator

    public OnDiskAtomIterator getColumnIterator(DecoratedKey key,
                                                ColumnFamily cf)

Specified by:
  `getColumnIterator` in interface `IDiskAtomFilter`

#### getSSTableColumnIterator

    public OnDiskAtomIterator getSSTableColumnIterator(SSTableReader sstable,
                                                       DecoratedKey key)

Description copied from interface: `IDiskAtomFilter`
returns an iterator that returns columns from the given SSTable matching the Filter criteria in sorted order.

Specified by:
  `getSSTableColumnIterator` in interface `IDiskAtomFilter`

#### getSSTableColumnIterator

    public OnDiskAtomIterator getSSTableColumnIterator(SSTableReader sstable,
                                                       FileDataInput file,
                                                       DecoratedKey key,
                                                       RowIndexEntry indexEntry)

Description copied from interface: `IDiskAtomFilter`
Get an iterator that returns columns from the given SSTable using the opened file matching the Filter criteria in sorted order.

Specified by:
  `getSSTableColumnIterator` in interface `IDiskAtomFilter`
  `file` - Already opened file data input, saves us opening another one
  `key` - The key of the row we are about to iterate over

#### getColumnComparator

    public java.util.Comparator<Cell> getColumnComparator(CellNameType comparator)

Specified by:
  `getColumnComparator` in interface `IDiskAtomFilter`

#### collectReducedColumns

    public void collectReducedColumns(ColumnFamily container,
                                      java.util.Iterator<Cell> reducedColumns,
                                      DecoratedKey key,
                                      int gcBefore,
                                      long now)

Description copied from interface: `IDiskAtomFilter`
collects columns from reducedColumns into returnCF. Termination is determined by the filter code, which should have some limit on the number of columns to avoid running out of memory on large rows.

Specified by:
  `collectReducedColumns` in interface `IDiskAtomFilter`

#### respectTombstoneThresholds

    protected boolean respectTombstoneThresholds()

#### getLiveCount

    public int getLiveCount(ColumnFamily cf,
                            long now)

Specified by:
  `getLiveCount` in interface `IDiskAtomFilter`

#### columnCounter

    public ColumnCounter columnCounter(CellNameType comparator,
                                       long now)

Specified by:
  `columnCounter` in interface `IDiskAtomFilter`

#### trim

    public ColumnFamily trim(ColumnFamily cf,
                             int trimTo,
                             long now)

#### start

    public Composite start()

#### finish

    public Composite finish()

#### setStart

    public void setStart(Composite start)

#### lastCounted

    public int lastCounted()

#### lastTombstones

    public int lastTombstones()

#### lastLive

    public int lastLive()

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### isReversed

    public boolean isReversed()

Specified by:
  `isReversed` in interface `IDiskAtomFilter`

#### updateColumnsLimit

    public void updateColumnsLimit(int newLimit)

Specified by:
  `updateColumnsLimit` in interface `IDiskAtomFilter`

#### maySelectPrefix

    public boolean maySelectPrefix(CType type,
                                   Composite prefix)

Specified by:
  `maySelectPrefix` in interface `IDiskAtomFilter`

#### shouldInclude

    public boolean shouldInclude(SSTableReader sstable)

Specified by:
  `shouldInclude` in interface `IDiskAtomFilter`

#### isHeadFilter

    public boolean isHeadFilter()

Specified by:
  `isHeadFilter` in interface `IDiskAtomFilter`

#### countCQL3Rows

    public boolean countCQL3Rows(CellNameType comparator)

Specified by:
  `countCQL3Rows` in interface `IDiskAtomFilter`

#### isFullyCoveredBy

    public boolean isFullyCoveredBy(ColumnFamily cf,
                                    long now)

Description copied from interface: `IDiskAtomFilter`
Whether the provided cf, that is assumed to contain the head of the partition, contains enough data to cover this filter.

Specified by:
  `isFullyCoveredBy` in interface `IDiskAtomFilter`

#### getRangeTombstoneIterator

    public java.util.Iterator<RangeTombstone> getRangeTombstoneIterator(ColumnFamily source)

Specified by:
  `getRangeTombstoneIterator` in interface `IDiskAtomFilter`