public int compareCustom(ByteBuffer o1, ByteBuffer o2) { // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner)); }
/** * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away, * modulo downsampling of the index summary). Always returns a {@code value >= 0} */ public long getIndexScanPosition(PartitionPosition key) { if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0) key = first; return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary); }
/** * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away, * modulo downsampling of the index summary). Always returns a {@code value >= 0} */ public long getIndexScanPosition(PartitionPosition key) { if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0) key = first; return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary); }
public int compareCustom(ByteBuffer o1, ByteBuffer o2) { // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner)); }
/** * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away, * modulo downsampling of the index summary). Always returns a {@code value >= 0} */ public long getIndexScanPosition(PartitionPosition key) { if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0) key = first; return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary); }
public int compareCustom(ByteBuffer o1, ByteBuffer o2) { // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner)); }
/** * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away, * modulo downsampling of the index summary). Always returns a {@code value >= 0} */ public long getIndexScanPosition(PartitionPosition key) { if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0) key = first; return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary); }
public int compareCustom(ByteBuffer o1, ByteBuffer o2) { // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner)); }
public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position) { // delegate to Token.KeyBound if needed if (!(position instanceof DecoratedKey)) return -position.compareTo(partitioner.decorateKey(key)); DecoratedKey otherKey = (DecoratedKey) position; int cmp = partitioner.getToken(key).compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp; }
public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position) { // delegate to Token.KeyBound if needed if (!(position instanceof DecoratedKey)) return -position.compareTo(partitioner.decorateKey(key)); DecoratedKey otherKey = (DecoratedKey) position; int cmp = partitioner.getToken(key).compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp; }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; // delegate to Token.KeyBound if needed if (!(pos instanceof DecoratedKey)) return -pos.compareTo(this); DecoratedKey otherKey = (DecoratedKey) pos; int cmp = getToken().compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp; }
public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position) { // delegate to Token.KeyBound if needed if (!(position instanceof DecoratedKey)) return -position.compareTo(partitioner.decorateKey(key)); DecoratedKey otherKey = (DecoratedKey) position; int cmp = partitioner.getToken(key).compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp; }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; // delegate to Token.KeyBound if needed if (!(pos instanceof DecoratedKey)) return -pos.compareTo(this); DecoratedKey otherKey = (DecoratedKey) pos; int cmp = getToken().compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp; }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; // delegate to Token.KeyBound if needed if (!(pos instanceof DecoratedKey)) return -pos.compareTo(this); DecoratedKey otherKey = (DecoratedKey) pos; int cmp = getToken().compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp; }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; // delegate to Token.KeyBound if needed if (!(pos instanceof DecoratedKey)) return -pos.compareTo(this); DecoratedKey otherKey = (DecoratedKey) pos; int cmp = getToken().compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp; }
public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position) { // delegate to Token.KeyBound if needed if (!(position instanceof DecoratedKey)) return -position.compareTo(partitioner.decorateKey(key)); DecoratedKey otherKey = (DecoratedKey) position; int cmp = partitioner.getToken(key).compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp; }
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); }); } }
private AbstractBounds<PartitionPosition> getPartitionKeyBounds(IPartitioner p, QueryOptions options) { // Deal with unrestricted partition key components (special-casing is required to deal with 2i queries on the // first component of a composite partition key) queries that filter on the partition key. if (partitionKeyRestrictions.needFiltering(cfm)) return new Range<>(p.getMinimumToken().minKeyBound(), p.getMinimumToken().maxKeyBound()); ByteBuffer startKeyBytes = getPartitionKeyBound(Bound.START, options); ByteBuffer finishKeyBytes = getPartitionKeyBound(Bound.END, options); PartitionPosition startKey = PartitionPosition.ForKey.get(startKeyBytes, p); PartitionPosition finishKey = PartitionPosition.ForKey.get(finishKeyBytes, p); if (startKey.compareTo(finishKey) > 0 && !finishKey.isMinimum()) return null; if (partitionKeyRestrictions.isInclusive(Bound.START)) { return partitionKeyRestrictions.isInclusive(Bound.END) ? new Bounds<>(startKey, finishKey) : new IncludingExcludingBounds<>(startKey, finishKey); } return partitionKeyRestrictions.isInclusive(Bound.END) ? new Range<>(startKey, finishKey) : new ExcludingBounds<>(startKey, finishKey); }