Class Slices

java.lang.Object
org.apache.cassandra.db.Slices
All Implemented Interfaces:
Iterable<Slice>

public abstract class Slices extends Object implements Iterable<Slice>
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.

  • Field Details

    • 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.
  • Constructor Details

    • Slices

      protected Slices()
  • Method Details

    • with

      public static Slices with(ClusteringComparator comparator, Slice slice)
      Creates a Slices object that contains a single slice.
      Parameters:
      comparator - the comparator for the table slice is a slice of.
      slice - the single slice that the return object should contain.
      Returns:
      the newly created Slices object.
    • hasLowerBound

      public abstract boolean hasLowerBound()
      Whether the slices instance has a lower bound, that is whether it's first slice start is Slice.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 is Slice.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

      public abstract Slice get(int i)
      Returns the ith slice of this Slices object.
      Returns:
      the ith slice of this object.
    • start

      public ClusteringBound<?> start()
    • end

      public ClusteringBound<?> 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 after lastReturned are returned (where coming after means "greater than" if !reversed and "lesser than" otherwise).
      inclusive - whether we want to include the lastReturned in 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 this Slices objects 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 Slices object.
    • selects

      public abstract boolean selects(Clustering<?> clustering)
      Whether a given clustering (row) is selected by this Slices object.
      Parameters:
      clustering - the clustering to test for selection.
      Returns:
      whether a given clustering (row) is selected by this Slices object.
    • intersects

      public abstract boolean intersects(Slice slice)
      Checks whether any of the slices intersects witht the given one.
      Returns:
      true if there exists a slice which (Slice.intersects(ClusteringComparator, Slice)) with the provided slice
    • toCQLString

      public abstract String toCQLString(TableMetadata metadata, RowFilter rowFilter)
    • isEmpty

      public final boolean isEmpty()
      Checks if this Slices is empty.
      Returns:
      true if this Slices is empty, false otherwise.