private Cell toOffheapCell( ByteBuffer valAndTagsBuffer, int vOffset, int tagsLenSerializationSize) { ByteBuffer tagsBuf = HConstants.EMPTY_BYTE_BUFFER; int tOffset = 0; if (this.includeTags) { if (this.tagCompressionContext == null) { tagsBuf = valAndTagsBuffer; tOffset = vOffset + this.valueLength + tagsLenSerializationSize; } else { tagsBuf = ByteBuffer.wrap(Bytes.copy(tagsBuffer, 0, this.tagsLength)); tOffset = 0; } } return new OffheapDecodedCell( ByteBuffer.wrap(Bytes.copy(keyBuffer, 0, this.keyLength)), currentKey.getRowLength(), currentKey.getFamilyOffset(), currentKey.getFamilyLength(), currentKey.getQualifierOffset(), currentKey.getQualifierLength(), currentKey.getTimestamp(), currentKey.getTypeByte(), valAndTagsBuffer, vOffset, this.valueLength, memstoreTS, tagsBuf, tOffset, this.tagsLength); }
/** * Find the column index which will replace the column name in the aggregated array and will be * restored in Reducer * * @param cell KeyValue for the column * @return column index for the specified cell or -1 if was not found */ private int findIndex(Cell cell) throws IOException { byte[] familyName = Bytes.copy(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()); byte[] name = Bytes.copy(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); byte[] cfn = Bytes.add(familyName, QueryConstants.NAMESPACE_SEPARATOR_BYTES, name); if (columnIndexes.containsKey(cfn)) { return columnIndexes.get(cfn); } return -1; }
/** * We make a copy of the passed in row key to keep local. * * @param rowArray * @param rowOffset * @param rowLength * @param ts */ public Put(byte[] rowArray, int rowOffset, int rowLength, long ts) { checkRow(rowArray, rowOffset, rowLength); this.row = Bytes.copy(rowArray, rowOffset, rowLength); this.ts = ts; if (ts < 0) { throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + ts); } }
/** * Create a Delete operation for the specified row and timestamp. * * <p>If no further operations are done, this will delete all columns in all families of the * specified row with a timestamp less than or equal to the specified timestamp. * * <p>This timestamp is ONLY used for a delete row operation. If specifying families or columns, * you must specify each timestamp individually. * * @param rowArray We make a local copy of this passed in row. * @param rowOffset * @param rowLength * @param ts maximum version timestamp (only for delete row) */ public Delete(final byte[] rowArray, final int rowOffset, final int rowLength, long ts) { checkRow(rowArray, rowOffset, rowLength); this.row = Bytes.copy(rowArray, rowOffset, rowLength); setTimestamp(ts); }