Java Code Examples for org.apache.hadoop.hbase.io.ImmutableBytesWritable#toString()
The following examples show how to use
org.apache.hadoop.hbase.io.ImmutableBytesWritable#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleTotalOrderPartitioner.java From hbase with Apache License 2.0 | 6 votes |
@Override public int getPartition(final ImmutableBytesWritable key, final VALUE value, final int reduces) { if (reduces == 1) return 0; if (this.lastReduces != reduces) { this.splits = Bytes.split(this.startkey, this.endkey, reduces - 1); for (int i = 0; i < splits.length; i++) { LOG.info(Bytes.toStringBinary(splits[i])); } this.lastReduces = reduces; } int pos = Bytes.binarySearch(this.splits, key.get(), key.getOffset(), key.getLength()); // Below code is from hfile index search. if (pos < 0) { pos++; pos *= -1; if (pos == 0) { // falls before the beginning of the file. throw new RuntimeException("Key outside start/stop range: " + key.toString()); } pos--; } return pos; }