Package org.apache.cassandra.db
Class Slices
- java.lang.Object
-
- org.apache.cassandra.db.Slices
-
- All Implemented Interfaces:
java.lang.Iterable<Slice>
public abstract class Slices extends java.lang.Object implements java.lang.Iterable<Slice>
Represents the selection of multiple range of rows within a partition.A
Slicesis basically a list ofSlice, though those are guaranteed to be non-overlapping and always in clustering order.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSlices.BuilderBuilder to createSlicesobjects.static interfaceSlices.InOrderTesterIn simple object that allows to test the inclusion of rows in those slices assuming those rows are passed (toSlices.InOrderTester.includes(org.apache.cassandra.db.Clustering<?>)) in clustering order (or reverse clustering ordered, depending of the argument passed toinOrderTester(boolean)).static classSlices.Serializer
-
Field Summary
Fields Modifier and Type Field Description static SlicesALLSlices selecting all the rows of a partition.static SlicesNONESlices selecting no rows in a partition.static Slices.Serializerserializer
-
Constructor Summary
Constructors Modifier Constructor Description protectedSlices()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract SlicesforPaging(ClusteringComparator comparator, Clustering<?> lastReturned, boolean inclusive, boolean reversed)Returns slices for continuing the paging of those slices given the last returned clustering prefix.abstract Sliceget(int i)Returns the ith slice of thisSlicesobject.abstract booleanhasLowerBound()Whether the slices has a lower bound, that is whether it's first slice start isSlice.BOTTOM.abstract booleanhasUpperBound()Whether the slices has an upper bound, that is whether it's last slice end isSlice.TOP.abstract Slices.InOrderTesterinOrderTester(boolean reversed)An object that allows to test whether rows are selected by thisSlicesobjects assuming those rows are tested in clustering order.abstract booleanintersects(java.util.List<java.nio.ByteBuffer> minClusteringValues, java.util.List<java.nio.ByteBuffer> maxClusteringValues)Given the per-clustering column minimum and maximum value a sstable contains, whether or not this slices potentially intersects that sstable or not.booleanisEmpty()Checks if thisSlicesis empty.abstract booleanselects(Clustering<?> clustering)Whether a given clustering (row) is selected by thisSlicesobject.abstract intsize()The number of slice this object contains.abstract java.lang.StringtoCQLString(TableMetadata metadata, RowFilter rowFilter)static Sliceswith(ClusteringComparator comparator, Slice slice)Creates aSlicesobject that contains a single slice.
-
-
-
Field Detail
-
serializer
public static final Slices.Serializer serializer
-
ALL
public static final Slices ALL
Slices selecting all the rows of a partition.
-
NONE
public static final Slices NONE
Slices selecting no rows in a partition.
-
-
Method Detail
-
with
public static Slices with(ClusteringComparator comparator, Slice slice)
Creates aSlicesobject that contains a single slice.- Parameters:
comparator- the comparator for the tablesliceis a slice of.slice- the single slice that the return object should contains.- Returns:
- the newly created
Slicesobject.
-
hasLowerBound
public abstract boolean hasLowerBound()
Whether the slices has a lower bound, that is whether it's first slice start isSlice.BOTTOM.- Returns:
- whether the slices has a lower bound.
-
hasUpperBound
public abstract boolean hasUpperBound()
Whether the slices has an upper bound, that is whether it's last slice end isSlice.TOP.- Returns:
- whether the slices has an upper bound.
-
size
public abstract int size()
The number of slice this object contains.- Returns:
- the number of slice this object contains.
-
get
public abstract Slice get(int i)
Returns the ith slice of thisSlicesobject.- Returns:
- the ith slice of this object.
-
forPaging
public abstract Slices forPaging(ClusteringComparator comparator, Clustering<?> lastReturned, boolean inclusive, boolean reversed)
Returns slices for continuing the paging of those slices given the last returned clustering prefix.- Parameters:
comparator- the comparator for the table this is a filter for.lastReturned- the last clustering that was returned for the query we are paging for. The resulting slices will be such that only results coming stricly afterlastReturnedare returned (where coming after means "greater than" if!reversedand "lesser than" otherwise).inclusive- whether or not we want to include thelastReturnedin the newly returned page of results.reversed- whether the query we're paging for is reversed or not.- Returns:
- new slices that select results coming after
lastReturned.
-
inOrderTester
public abstract Slices.InOrderTester inOrderTester(boolean reversed)
An object that allows to test whether rows are selected by thisSlicesobjects assuming those rows are tested in clustering order.- Parameters:
reversed- if true, the rows passed to the returned object will be assumed to be in reversed clustering order, otherwise they should be in clustering order.- Returns:
- an object that tests for selection of rows by this
Slicesobject.
-
selects
public abstract boolean selects(Clustering<?> clustering)
Whether a given clustering (row) is selected by thisSlicesobject.- Parameters:
clustering- the clustering to test for selection.- Returns:
- whether a given clustering (row) is selected by this
Slicesobject.
-
intersects
public abstract boolean intersects(java.util.List<java.nio.ByteBuffer> minClusteringValues, java.util.List<java.nio.ByteBuffer> maxClusteringValues)Given the per-clustering column minimum and maximum value a sstable contains, whether or not this slices potentially intersects that sstable or not.- Parameters:
minClusteringValues- the smallest values for each clustering column that a sstable contains.maxClusteringValues- the biggest values for each clustering column that a sstable contains.- Returns:
- whether the slices might intersects with the sstable having
minClusteringValuesandmaxClusteringValues.
-
toCQLString
public abstract java.lang.String toCQLString(TableMetadata metadata, RowFilter rowFilter)
-
isEmpty
public final boolean isEmpty()
Checks if thisSlicesis empty.- Returns:
trueif thisSlicesis empty,falseotherwise.
-
-