List of usage examples for org.apache.cassandra.db DataRange clusteringIndexFilter
ClusteringIndexFilter clusteringIndexFilter
To view the source code for org.apache.cassandra.db DataRange clusteringIndexFilter.
Click Source Link
From source file:com.stratio.cassandra.lucene.key.KeyMapper.java
License:Apache License
/** * Returns the start {@link ClusteringPrefix} of the first partition of the specified {@link DataRange}. * * @param dataRange the data range/*from w ww . j a va 2s . c o m*/ * @return the start clustering prefix of {@code dataRange}, or {@code null} if there is no such start */ public static Optional<ClusteringPrefix> startClusteringPrefix(DataRange dataRange) { PartitionPosition startPosition = dataRange.startKey(); if (startPosition instanceof DecoratedKey) { DecoratedKey startKey = (DecoratedKey) startPosition; ClusteringIndexFilter filter = dataRange.clusteringIndexFilter(startKey); if (filter instanceof ClusteringIndexSliceFilter) { ClusteringIndexSliceFilter sliceFilter = (ClusteringIndexSliceFilter) filter; Slices slices = sliceFilter.requestedSlices(); return Optional.of(slices.get(0).start()); } } return Optional.empty(); }
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/*w w w. ja v a2 s.co 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(); }