List of usage examples for org.apache.cassandra.db Slices size
public abstract int size();
From source file:com.stratio.cassandra.lucene.key.KeyMapper.java
License:Apache License
/** * Returns the stop {@link ClusteringPrefix} of the last partition of the specified {@link DataRange}. * * @param dataRange the data range//from ww w . j av a2 s. c o m * @return the stop clustering prefix of {@code dataRange}, or {@code null} if there is no such start */ public static Optional<ClusteringPrefix> stopClusteringPrefix(DataRange dataRange) { PartitionPosition stopPosition = dataRange.stopKey(); if (stopPosition instanceof DecoratedKey) { DecoratedKey stopKey = (DecoratedKey) stopPosition; ClusteringIndexFilter filter = dataRange.clusteringIndexFilter(stopKey); if (filter instanceof ClusteringIndexSliceFilter) { ClusteringIndexSliceFilter sliceFilter = (ClusteringIndexSliceFilter) filter; Slices slices = sliceFilter.requestedSlices(); return Optional.of(slices.get(slices.size() - 1).end()); } } return Optional.empty(); }
From source file:com.stratio.cassandra.lucene.key.KeyMapper.java
License:Apache License
/** * Returns a Lucene {@link Query} to retrieve all the rows in the specified clustering slice filter. * * @param key the partition key// w w w. j a va 2s. co m * @param sliceFilter the slice filter * @return the Lucene query */ public Query query(DecoratedKey key, ClusteringIndexSliceFilter sliceFilter) { Slices slices = sliceFilter.requestedSlices(); ClusteringPrefix startBound = slices.get(0).start(); ClusteringPrefix stopBound = slices.get(slices.size() - 1).end(); return query(key, startBound, stopBound, false, false); }