private Paging(AbstractBounds<PartitionPosition> range, ClusteringIndexFilter filter, ClusteringComparator comparator, Clustering lastReturned, boolean inclusive) { super(range, filter); // When using a paging range, we don't allow wrapped ranges, as it's unclear how to handle them properly. // This is ok for now since we only need this in range queries, and the range are "unwrapped" in that case. assert !(range instanceof Range) || !((Range<?>)range).isWrapAround() || range.right.isMinimum() : range; assert lastReturned != null; this.comparator = comparator; this.lastReturned = lastReturned; this.inclusive = inclusive; }
private Paging(AbstractBounds<PartitionPosition> range, ClusteringIndexFilter filter, ClusteringComparator comparator, Clustering lastReturned, boolean inclusive) { super(range, filter); // When using a paging range, we don't allow wrapped ranges, as it's unclear how to handle them properly. // This is ok for now since we only need this in range queries, and the range are "unwrapped" in that case. assert !(range instanceof Range) || !((Range<?>)range).isWrapAround() || range.right.isMinimum() : range; assert lastReturned != null; this.comparator = comparator; this.lastReturned = lastReturned; this.inclusive = inclusive; }
private Paging(AbstractBounds<PartitionPosition> range, ClusteringIndexFilter filter, ClusteringComparator comparator, Clustering lastReturned, boolean inclusive) { super(range, filter); // When using a paging range, we don't allow wrapped ranges, as it's unclear how to handle them properly. // This is ok for now since we only need this in range queries, and the range are "unwrapped" in that case. assert !(range instanceof Range) || !((Range<?>)range).isWrapAround() || range.right.isMinimum() : range; assert lastReturned != null; this.comparator = comparator; this.lastReturned = lastReturned; this.inclusive = inclusive; }
private Paging(AbstractBounds<PartitionPosition> range, ClusteringIndexFilter filter, ClusteringComparator comparator, Clustering lastReturned, boolean inclusive) { super(range, filter); // When using a paging range, we don't allow wrapped ranges, as it's unclear how to handle them properly. // This is ok for now since we only need this in range queries, and the range are "unwrapped" in that case. assert !(range instanceof Range) || !((Range<?>)range).isWrapAround() || range.right.isMinimum() : range; assert lastReturned != null; this.comparator = comparator; this.lastReturned = lastReturned; this.inclusive = inclusive; }
/** * Whether this {@code DataRange} queries everything (has no restriction neither on the * partition queried, nor within the queried partition). * * @return Whether this {@code DataRange} queries everything. */ public boolean isUnrestricted() { return startKey().isMinimum() && stopKey().isMinimum() && clusteringIndexFilter.selectsAllPartition(); }
/** * Whether this {@code DataRange} queries everything (has no restriction neither on the * partition queried, nor within the queried partition). * * @return Whether this {@code DataRange} queries everything. */ public boolean isUnrestricted() { return startKey().isMinimum() && stopKey().isMinimum() && clusteringIndexFilter.selectsAllPartition(); }
/** * Whether this {@code DataRange} queries everything (has no restriction neither on the * partition queried, nor within the queried partition). * * @return Whether this {@code DataRange} queries everything. */ public boolean isUnrestricted() { return startKey().isMinimum() && stopKey().isMinimum() && clusteringIndexFilter.selectsAllPartition(); }
/** * Whether this {@code DataRange} queries everything (has no restriction neither on the * partition queried, nor within the queried partition). * * @return Whether this {@code DataRange} queries everything. */ public boolean isUnrestricted() { return startKey().isMinimum() && stopKey().isMinimum() && clusteringIndexFilter.selectsAllPartition(); }
public MemtableUnfilteredPartitionIterator makePartitionIterator(final ColumnFilter columnFilter, final DataRange dataRange, final boolean isForThrift) { AbstractBounds<PartitionPosition> keyRange = dataRange.keyRange(); boolean startIsMin = keyRange.left.isMinimum(); boolean stopIsMin = keyRange.right.isMinimum(); boolean isBound = keyRange instanceof Bounds; boolean includeStart = isBound || keyRange instanceof IncludingExcludingBounds; boolean includeStop = isBound || keyRange instanceof Range; Map<PartitionPosition, AtomicBTreePartition> subMap; if (startIsMin) subMap = stopIsMin ? partitions : partitions.headMap(keyRange.right, includeStop); else subMap = stopIsMin ? partitions.tailMap(keyRange.left, includeStart) : partitions.subMap(keyRange.left, includeStart, keyRange.right, includeStop); int minLocalDeletionTime = Integer.MAX_VALUE; // avoid iterating over the memtable if we purge all tombstones if (cfs.getCompactionStrategyManager().onlyPurgeRepairedTombstones()) minLocalDeletionTime = findMinLocalDeletionTime(subMap.entrySet().iterator()); final Iterator<Map.Entry<PartitionPosition, AtomicBTreePartition>> iter = subMap.entrySet().iterator(); return new MemtableUnfilteredPartitionIterator(cfs, iter, isForThrift, minLocalDeletionTime, columnFilter, dataRange); }
public MemtableUnfilteredPartitionIterator makePartitionIterator(final ColumnFilter columnFilter, final DataRange dataRange, final boolean isForThrift) { AbstractBounds<PartitionPosition> keyRange = dataRange.keyRange(); boolean startIsMin = keyRange.left.isMinimum(); boolean stopIsMin = keyRange.right.isMinimum(); boolean isBound = keyRange instanceof Bounds; boolean includeStart = isBound || keyRange instanceof IncludingExcludingBounds; boolean includeStop = isBound || keyRange instanceof Range; Map<PartitionPosition, AtomicBTreePartition> subMap; if (startIsMin) subMap = stopIsMin ? partitions : partitions.headMap(keyRange.right, includeStop); else subMap = stopIsMin ? partitions.tailMap(keyRange.left, includeStart) : partitions.subMap(keyRange.left, includeStart, keyRange.right, includeStop); int minLocalDeletionTime = Integer.MAX_VALUE; // avoid iterating over the memtable if we purge all tombstones if (cfs.getCompactionStrategyManager().onlyPurgeRepairedTombstones()) minLocalDeletionTime = findMinLocalDeletionTime(subMap.entrySet().iterator()); final Iterator<Map.Entry<PartitionPosition, AtomicBTreePartition>> iter = subMap.entrySet().iterator(); return new MemtableUnfilteredPartitionIterator(cfs, iter, isForThrift, minLocalDeletionTime, columnFilter, dataRange); }
public String toCQLString(CFMetaData metadata) { if (isUnrestricted()) return "UNRESTRICTED"; StringBuilder sb = new StringBuilder(); boolean needAnd = false; if (!startKey().isMinimum()) { appendClause(startKey(), sb, metadata, true, keyRange.isStartInclusive()); needAnd = true; } if (!stopKey().isMinimum()) { if (needAnd) sb.append(" AND "); appendClause(stopKey(), sb, metadata, false, keyRange.isEndInclusive()); needAnd = true; } String filterString = clusteringIndexFilter.toCQLString(metadata); if (!filterString.isEmpty()) sb.append(needAnd ? " AND " : "").append(filterString); return sb.toString(); }
/** * Returns the sstables that have any partition between {@code left} and {@code right}, when both bounds are taken inclusively. * The interval formed by {@code left} and {@code right} shouldn't wrap. */ public Iterable<SSTableReader> liveSSTablesInBounds(PartitionPosition left, PartitionPosition right) { assert !AbstractBounds.strictlyWrapsAround(left, right); if (intervalTree.isEmpty()) return Collections.emptyList(); PartitionPosition stopInTree = right.isMinimum() ? intervalTree.max() : right; return intervalTree.search(Interval.create(left, stopInTree)); }
/** * Returns the sstables that have any partition between {@code left} and {@code right}, when both bounds are taken inclusively. * The interval formed by {@code left} and {@code right} shouldn't wrap. */ public Iterable<SSTableReader> liveSSTablesInBounds(PartitionPosition left, PartitionPosition right) { assert !AbstractBounds.strictlyWrapsAround(left, right); if (intervalTree.isEmpty()) return Collections.emptyList(); PartitionPosition stopInTree = right.isMinimum() ? intervalTree.max() : right; return intervalTree.search(Interval.create(left, stopInTree)); }
public static List<SSTableReader> sstablesInBounds(PartitionPosition left, PartitionPosition right, SSTableIntervalTree intervalTree) { assert !AbstractBounds.strictlyWrapsAround(left, right); if (intervalTree.isEmpty()) return Collections.emptyList(); PartitionPosition stopInTree = right.isMinimum() ? intervalTree.max() : right; return intervalTree.search(Interval.create(left, stopInTree)); }
public static List<SSTableReader> sstablesInBounds(PartitionPosition left, PartitionPosition right, SSTableIntervalTree intervalTree) { assert !AbstractBounds.strictlyWrapsAround(left, right); if (intervalTree.isEmpty()) return Collections.emptyList(); PartitionPosition stopInTree = right.isMinimum() ? intervalTree.max() : right; return intervalTree.search(Interval.create(left, stopInTree)); }
/** * Returns the sstables that have any partition between {@code left} and {@code right}, when both bounds are taken inclusively. * The interval formed by {@code left} and {@code right} shouldn't wrap. */ public Iterable<SSTableReader> liveSSTablesInBounds(PartitionPosition left, PartitionPosition right) { assert !AbstractBounds.strictlyWrapsAround(left, right); if (intervalTree.isEmpty()) return Collections.emptyList(); PartitionPosition stopInTree = right.isMinimum() ? intervalTree.max() : right; return intervalTree.search(Interval.create(left, stopInTree)); }
public static List<SSTableReader> sstablesInBounds(PartitionPosition left, PartitionPosition right, SSTableIntervalTree intervalTree) { assert !AbstractBounds.strictlyWrapsAround(left, right); if (intervalTree.isEmpty()) return Collections.emptyList(); PartitionPosition stopInTree = right.isMinimum() ? intervalTree.max() : right; return intervalTree.search(Interval.create(left, stopInTree)); }
private Set<SSTableIndex> applyScope(Set<SSTableIndex> indexes) { return Sets.filter(indexes, index -> { SSTableReader sstable = index.getSSTable(); return range.startKey().compareTo(sstable.last) <= 0 && (range.stopKey().isMinimum() || sstable.first.compareTo(range.stopKey()) <= 0); }); } }
private Set<SSTableIndex> applyScope(Set<SSTableIndex> indexes) { return Sets.filter(indexes, index -> { SSTableReader sstable = index.getSSTable(); return range.startKey().compareTo(sstable.last) <= 0 && (range.stopKey().isMinimum() || sstable.first.compareTo(range.stopKey()) <= 0); }); } }
private Set<SSTableIndex> applyScope(Set<SSTableIndex> indexes) { return Sets.filter(indexes, index -> { SSTableReader sstable = index.getSSTable(); return range.startKey().compareTo(sstable.last) <= 0 && (range.stopKey().isMinimum() || sstable.first.compareTo(range.stopKey()) <= 0); }); } }