@Override public byte[] getRowArray() { return CellUtil.cloneRow(this); }
/** * Method for retrieving the row key that corresponds to * the row from which this Result was created. * @return row */ public byte [] getRow() { if (this.row == null) { this.row = (this.cells == null || this.cells.length == 0) ? null : CellUtil.cloneRow(this.cells[0]); } return this.row; }
@Override public byte[] getRowArray() { return CellUtil.cloneRow(this); }
@Override public byte[] getRowArray() { if (this.buf.hasArray()) { return this.buf.array(); } return CellUtil.cloneRow(this); }
/** * Converts cell key to backup set name. * @param current current cell * @return backup set name */ private String cellKeyToBackupSetName(Cell current) { byte[] data = CellUtil.cloneRow(current); return Bytes.toString(data).substring(SET_KEY_PREFIX.length()); }
private void collectRow() { rowSizeBytes.update(curRowBytes); rowSizeCols.update(curRowCols); keyLen.update(curRowKeyLength); if (curRowBytes > maxRowBytes && prevCell != null) { biggestRow = CellUtil.cloneRow(prevCell); maxRowBytes = curRowBytes; } curRowBytes = 0; curRowCols = 0; }
@Override public ByteBuffer getRowByteBuffer() { if (cell instanceof ByteBufferExtendedCell) { return ((ByteBufferExtendedCell) this.cell).getRowByteBuffer(); } else { return ByteBuffer.wrap(CellUtil.cloneRow(this.cell)); } }
public void waitUntilCanPush(Entry entry, Cell firstCellInEdit) throws IOException, InterruptedException { byte[] row = CellUtil.cloneRow(firstCellInEdit); while (!canPush(entry, row)) { LOG.debug("Can not push {}, wait", entry); Thread.sleep(waitTimeMs); } } }
@Override public void map(NullWritable key, Cell value, Context context) throws IOException, InterruptedException { context.write(new ImmutableBytesWritable(CellUtil.cloneRow(value)), new MapReduceExtendedCell(value)); }
@Override public boolean filterRowKey(Cell cell) throws IOException { try { Thread.sleep(CLIENT_TIMEOUT / 2 - 100); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return !Bytes.equals(CellUtil.cloneRow(cell), ROWS[NUM_ROWS - 1]); }
@Override public ReturnCode filterCell(final Cell v) throws IOException { try { Thread.sleep(CLIENT_TIMEOUT / 2 + 100); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return Bytes.equals(CellUtil.cloneRow(v), ROWS[NUM_ROWS - 1]) ? ReturnCode.INCLUDE : ReturnCode.SKIP; }
private static String getRowQualStr(Cell kv) { String rowStr = Bytes.toString(CellUtil.cloneRow(kv)); String qualStr = Bytes.toString(CellUtil.cloneQualifier(kv)); return rowStr + "_" + qualStr; }
/** * Decrement the timestamp. For tests (currently wasteful) * * Remember timestamps are sorted reverse chronologically. * @param in * @return previous key */ public static KeyValue previousKey(final KeyValue in) { return createFirstOnRow(CellUtil.cloneRow(in), CellUtil.cloneFamily(in), CellUtil.cloneQualifier(in), in.getTimestamp() - 1); }
@Override public Void answer(InvocationOnMock invocation) throws Throwable { ImmutableBytesWritable writer = (ImmutableBytesWritable) invocation.getArgument(0); MapReduceExtendedCell key = (MapReduceExtendedCell) invocation.getArgument(1); assertEquals("row", Bytes.toString(writer.get())); assertEquals("row", Bytes.toString(CellUtil.cloneRow(key))); return null; } }).when(context).write(any(), any());
@Override public Void answer(InvocationOnMock invocation) throws Throwable { ImmutableBytesWritable writer = (ImmutableBytesWritable) invocation.getArgument(0); MapReduceExtendedCell key = (MapReduceExtendedCell) invocation.getArgument(1); assertEquals("Key", Bytes.toString(writer.get())); assertEquals("row", Bytes.toString(CellUtil.cloneRow(key))); return null; } }).when(ctx).write(any(), any());
@Override public ReturnCode filterCell(final Cell c) throws IOException { Threads.sleep(TIMEOUT / 2 + 100); return Bytes.equals(CellUtil.cloneRow(c), ROWS[reversed ? 0 : NUM_ROWS - 1]) ? ReturnCode.INCLUDE : ReturnCode.SKIP; }
private static void assertRowAndValue(Result r, byte[] row, byte[] value) { for (Cell c : r.rawCells()) { assertTrue(Bytes.equals(CellUtil.cloneRow(c), row)); assertTrue(Bytes.equals(CellUtil.cloneValue(c), value)); } }
static int replayEdit(HRegion region, WAL.Entry entry) throws IOException { if (WALEdit.isMetaEditFamily(entry.getEdit().getCells().get(0))) { return 0; // handled elsewhere } Put put = new Put(CellUtil.cloneRow(entry.getEdit().getCells().get(0))); for (Cell cell : entry.getEdit().getCells()) put.add(cell); put.setDurability(Durability.SKIP_WAL); MutationReplay mutation = new MutationReplay(MutationType.PUT, put, 0, 0); region.batchReplay(new MutationReplay[] {mutation}, entry.getKey().getSequenceId()); return Integer.parseInt(Bytes.toString(put.getRow())); }
/** * Assert the value is not store in mob. */ private static void assertNotMobReference(Cell cell, byte[] row, byte[] family, byte[] value) throws IOException { Assert.assertArrayEquals(row, CellUtil.cloneRow(cell)); Assert.assertArrayEquals(family, CellUtil.cloneFamily(cell)); Assert.assertArrayEquals(value, CellUtil.cloneValue(cell)); }
private static void assertResult(Result result, byte[] expectedValue) { assertFalse(result.isEmpty()); for (Cell c : result.rawCells()) { assertTrue(c.toString(), Bytes.equals(ROW, CellUtil.cloneRow(c))); assertTrue(c.toString(), Bytes.equals(FAMILY, CellUtil.cloneFamily(c))); assertTrue(c.toString(), Bytes.equals(expectedValue, CellUtil.cloneValue(c))); } }