Codota Logo
PartitionPosition.compareTo
Code IndexAdd Codota to your IDE (free)

How to use
compareTo
method
in
org.apache.cassandra.db.PartitionPosition

Best Java code snippets using org.apache.cassandra.db.PartitionPosition.compareTo (Showing top 20 results out of 315)

  • Common ways to obtain PartitionPosition
private void myMethod () {
PartitionPosition p =
  • Codota IconToken token;token.maxKeyBound()
  • Codota IconToken token;token.minKeyBound()
  • Codota IconDecoratedKey decoratedKey;decoratedKey.getToken().minKeyBound()
  • Smart code suggestions by Codota
}
origin: jsevellec/cassandra-unit

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));
}
origin: com.strapdata.cassandra/cassandra-all

/**
 * 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);
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

/**
 * 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);
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

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));
}
origin: org.apache.cassandra/cassandra-all

/**
 * 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);
}
origin: org.apache.cassandra/cassandra-all

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));
}
origin: jsevellec/cassandra-unit

/**
 * 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);
}
origin: com.strapdata.cassandra/cassandra-all

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));
}
origin: jsevellec/cassandra-unit

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;
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

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;
}
origin: org.apache.cassandra/cassandra-all

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;
}
origin: org.apache.cassandra/cassandra-all

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;
}
origin: jsevellec/cassandra-unit

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;
}
origin: com.strapdata.cassandra/cassandra-all

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;
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

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;
}
origin: com.strapdata.cassandra/cassandra-all

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;
}
origin: org.apache.cassandra/cassandra-all

  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);
    });
  }
}
origin: com.strapdata.cassandra/cassandra-all

  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);
    });
  }
}
origin: jsevellec/cassandra-unit

  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);
    });
  }
}
origin: jsevellec/cassandra-unit

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);
}
org.apache.cassandra.dbPartitionPositioncompareTo

Popular methods of PartitionPosition

  • isMinimum
  • getToken
  • kind

Popular in Java

  • Creating JSON documents from java classes using gson
  • getContentResolver (Context)
  • orElseThrow (Optional)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Menu (java.awt)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • JComboBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now