Package org.apache.cassandra.db
Class Slices
java.lang.Object
org.apache.cassandra.db.Slices
Represents the selection of multiple range of rows within a partition.
A Slices is basically a list of Slice, though those are guaranteed to be non-overlapping
and always in clustering order.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder to createSlicesobjects.static interfaceIn 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 on the argument passed toinOrderTester(boolean)).static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SlicesSlices selecting all the rows of a partition.static final SlicesSlices selecting no rows in a partition.static final Slices.Serializer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionend()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 booleanWhether the slices instance has a lower bound, that is whether it's first slice start isSlice.BOTTOM.abstract booleanWhether the slices instance 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(Slice slice) Checks whether any of the slices intersects witht the given one.final 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.start()abstract StringtoCQLString(TableMetadata metadata, RowFilter rowFilter) static Sliceswith(ClusteringComparator comparator, Slice slice) Creates aSlicesobject that contains a single slice.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Field Details
-
serializer
-
ALL
Slices selecting all the rows of a partition. -
NONE
Slices selecting no rows in a partition.
-
-
Constructor Details
-
Slices
protected Slices()
-
-
Method Details
-
with
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 contain.- Returns:
- the newly created
Slicesobject.
-
hasLowerBound
public abstract boolean hasLowerBound()Whether the slices instance has a lower bound, that is whether it's first slice start isSlice.BOTTOM.- Returns:
- whether this slices instance has a lower bound.
-
hasUpperBound
public abstract boolean hasUpperBound()Whether the slices instance has an upper bound, that is whether it's last slice end isSlice.TOP.- Returns:
- whether this slices instance 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
Returns the ith slice of thisSlicesobject.- Returns:
- the ith slice of this object.
-
start
-
end
-
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 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
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
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
Checks whether any of the slices intersects witht the given one.- Returns:
trueif there exists a slice which (Slice.intersects(ClusteringComparator, Slice)) with the provided slice
-
toCQLString
-
isEmpty
public final boolean isEmpty()Checks if thisSlicesis empty.- Returns:
trueif thisSlicesis empty,falseotherwise.
-