int rightColumnLength = rightKey.length - rightCommonLengthWithTSAndType; if (leftRowLength == rightRowLength && compareRows(leftKey, ROW_LENGTH_SIZE, leftRowLength, rightKey, ROW_LENGTH_SIZE, rightRowLength) == 0) {
protected boolean isStopRow(byte[] currentRow, int offset, short length) { return currentRow == null || (stopRow != null && comparator.compareRows(stopRow, 0, stopRow.length, currentRow, offset, length) <= isScan); }
/** * Compare two keys. Keys must not be open (isOpen(row) == false). */ private final int nonOpenRowCompare(byte[] k1, byte[] k2) { assert !isOpen(k1) && !isOpen(k2); return kvComparator.compareRows(k1, 0, k1.length, k2, 0, k2.length); }
@Override protected void checkScanOrder(Cell prevKV, Cell kv, KeyValue.KVComparator comparator) throws IOException { // Check that the heap gives us KVs in an increasing order for same row and // decreasing order for different rows. assert prevKV == null || comparator == null || comparator.compareRows(kv, prevKV) < 0 || (comparator.matchingRows(kv, prevKV) && comparator.compare(kv, prevKV) >= 0) : "Key " + prevKV + " followed by a " + "error order key " + kv + " in cf " + store + " in reversed scan"; }
@Override public boolean backwardSeek(Cell key) throws IOException { seek(key); if (cur == null || getComparator().compareRows(cur.getRowArray(), cur.getRowOffset(), cur.getRowLength(), key.getRowArray(), key.getRowOffset(), key.getRowLength()) > 0) { return seekToPreviousRow(key); } return true; }
/** * Compares rows of two KeyValue * @param left * @param right * @return less than 0 if left is smaller, 0 if equal etc.. */ public int compareRows(Cell left, Cell right) { return super.kvComparator.compareRows(left, right); } }
private KeyValue getLowest(final KeyValue a, final KeyValue b) { if (a == null) { return b; } if (b == null) { return a; } return comparator.compareRows(a, b) <= 0? a: b; }
private boolean seekToScanner(final HFileScanner scanner, final KeyValue firstOnRow, final KeyValue firstKV) throws IOException { KeyValue kv = firstOnRow; // If firstOnRow < firstKV, set to firstKV if (this.comparator.compareRows(firstKV, firstOnRow) == 0) kv = firstKV; int result = scanner.seekTo(kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength()); return result >= 0; }
/** * @param left * @param right * @return Result comparing rows. */ public int compareRows(final Cell left, final Cell right) { return compareRows(left.getRowArray(),left.getRowOffset(), left.getRowLength(), right.getRowArray(), right.getRowOffset(), right.getRowLength()); }
boolean isBetterCandidate(final KeyValue contender) { return this.candidate == null || (this.kvcomparator.compareRows(this.candidate, contender) < 0 && this.kvcomparator.compareRows(contender, this.targetkey) <= 0); }
/** * @param left * @param right * @return Result comparing rows. */ public int compareRows(final KeyValue left, final KeyValue right) { return compareRows(left, left.getRowLength(), right, right.getRowLength()); }
private boolean isStopRow(byte [] currentRow, int offset, short length) { return currentRow == null || (stopRow != null && comparator.compareRows(stopRow, 0, stopRow.length, currentRow, offset, length) <= isScan); }
public void collect(KeyValue kv) { keyLen.collect(kv.getKeyLength()); valLen.collect(kv.getValueLength()); if (prevKV != null && KeyValue.COMPARATOR.compareRows(prevKV, kv) != 0) { // new row collectRow(); } curRowBytes += kv.getLength(); curRowCols++; prevKV = kv; }
/** * @param kv Current kv * @param First on row kv. * @param state * @return True if we went too far, past the target key. */ boolean isTooFar(final KeyValue kv, final KeyValue firstOnRow) { return this.kvcomparator.compareRows(kv, firstOnRow) > 0; }
/** * @param left * @param right * @return Result comparing rows. */ public int compareRows(final Cell left, final Cell right) { return compareRows(left.getRowArray(),left.getRowOffset(), left.getRowLength(), right.getRowArray(), right.getRowOffset(), right.getRowLength()); }
result = super.compareRows(left, leftDelimiter, lpart, right, rightDelimiter, rpart); if (result != 0) { return result;
long ts, byte type) { int compare = compareRows( cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), row, roff, rlen);
comparisonResult = compareRows(left, loffset + ROW_LENGTH_SIZE, lrowlength, right, roffset + ROW_LENGTH_SIZE, rrowlength); } else { // the row length is the same comparisonResult = compareRows( left, loffset + common + ROW_LENGTH_SIZE, lrowlength - common, right, roffset + common + ROW_LENGTH_SIZE, rrowlength - common);
/** * Compares left to right assuming that left,loffset,llength and right,roffset,rlength are * full KVs laid out in a flat byte[]s. * @param left * @param loffset * @param llength * @param right * @param roffset * @param rlength * @return 0 if equal, <0 if left smaller, >0 if right smaller */ public int compareFlatKey(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength) { // Compare row short lrowlength = Bytes.toShort(left, loffset); short rrowlength = Bytes.toShort(right, roffset); int compare = compareRows(left, loffset + Bytes.SIZEOF_SHORT, lrowlength, right, roffset + Bytes.SIZEOF_SHORT, rrowlength); if (compare != 0) { return compare; } // Compare the rest of the two KVs without making any assumptions about // the common prefix. This function will not compare rows anyway, so we // don't need to tell it that the common prefix includes the row. return compareWithoutRow(0, left, loffset, llength, right, roffset, rlength, rrowlength); }
/** * @param left * @param right * @return Result comparing rows. */ public int compareRows(final Cell left, final Cell right) { return compareRows(left.getRowArray(),left.getRowOffset(), left.getRowLength(), right.getRowArray(), right.getRowOffset(), right.getRowLength()); }