private int getTerminatorCount(RowKeySchema schema) { int nTerminators = 0; for (int i = 0; i < schema.getFieldCount(); i++) { Field field = schema.getField(i); // We won't have a terminator on the last PK column // unless it is variable length and exclusive, but // having the extra byte irregardless won't hurt anything if (!field.getType().isFixedWidth()) { nTerminators++; } } return nTerminators; }
private int setStartKey(ImmutableBytesWritable ptr, int offset, int i) { int length = ptr.getOffset() - offset; startKey = copyKey(startKey, length + this.maxKeyLength, ptr.get(), offset, length); startKeyLength = length; // Add separator byte if we're at the end of the buffer, since trailing separator bytes are // stripped if (ptr.getOffset() + ptr.getLength() == offset + length && i - 1 > 0 && !schema.getField(i - 1).getType().isFixedWidth()) { startKey[startKeyLength++] = QueryConstants.SEPARATOR_BYTE; } startKeyLength += setKey(Bound.LOWER, startKey, startKeyLength, i); return length; }