@Override public void write(final DataOutput out) throws IOException { ProtobufUtil.toMutationNoData(MutationType.PUT, put).writeDelimitedTo(DataOutputOutputStream.from(out)); out.writeInt(put.size()); CellScanner scanner = put.cellScanner(); while(scanner.advance()) { KeyValue kv = KeyValueUtil.ensureKeyValue(scanner.current()); KeyValue.write(kv, out); } } }
if (put != null && put.size() >= sourceTableHash.scanBatch) { context.write(new ImmutableBytesWritable(rowKey), put); put = null;
put.addColumn(CONTENTS_FAMILY, null, value); assertEquals(1, put.size()); assertEquals(1, put.getFamilyCellMap().get(CONTENTS_FAMILY).size());
public void prepareTestData() throws Exception { try { util.getAdmin().disableTable(TABLE); util.getAdmin().deleteTable(TABLE); } catch (Exception e) { // ignore table not found } table = util.createTable(TABLE, FAM); { Put put = new Put(ROW); put.addColumn(FAM, A, Bytes.add(B, C)); // B, C are friends of A put.addColumn(FAM, B, Bytes.add(D, E, F)); // D, E, F are friends of B put.addColumn(FAM, C, G); // G is a friend of C table.put(put); rowSize = put.size(); } Put put = new Put(ROW2); put.addColumn(FAM, D, E); put.addColumn(FAM, F, G); table.put(put); row2Size = put.size(); }
private int comparePuts(Put p1, Put p2) { int p1Size = p1.size(); int p2Size = p2.size(); int compare = p1Size - p2Size; if (compare == 0) { // TODO: make this a real comparison // this is a little cheating, but we don't really need to worry too much about this being // the same - chances are that exact matches here are really the same update. return Longs.compare(p1.heapSize(), p2.heapSize()); } return compare; }
private int comparePuts(Put p1, Put p2) { int p1Size = p1.size(); int p2Size = p2.size(); int compare = p1Size - p2Size; if (compare == 0) { // TODO: make this a real comparison // this is a little cheating, but we don't really need to worry too much about this being // the same - chances are that exact matches here are really the same update. return Longs.compare(p1.heapSize(), p2.heapSize()); } return compare; }
public static void main(String[] args) throws Exception { // vv FingerprintExample Put put = new Put(Bytes.toBytes("testrow")); put.addColumn(Bytes.toBytes("fam-1"), Bytes.toBytes("qual-1"), Bytes.toBytes("val-1")); put.addColumn(Bytes.toBytes("fam-1"), Bytes.toBytes("qual-2"), Bytes.toBytes("val-2")); put.addColumn(Bytes.toBytes("fam-2"), Bytes.toBytes("qual-3"), Bytes.toBytes("val-3")); String id = String.format("Hostname: %s, App: %s", InetAddress.getLocalHost().getHostName(), System.getProperty("sun.java.command")); put.setId(id); System.out.println("Put.size: " + put.size()); System.out.println("Put.id: " + put.getId()); System.out.println("Put.fingerprint: " + put.getFingerprint()); System.out.println("Put.toMap: " + put.toMap()); System.out.println("Put.toJSON: " + put.toJSON()); System.out.println("Put.toString: " + put.toString()); // ^^ FingerprintExample } }
@Override public Mutations getWriteOperations() { List<Row> rows = new ArrayList<>(2); // if any qualifiers if (this.row != null && this.row.size() > 0) rows.add(this.row); // for delete , can be just the oper with no qualifiers if (this.delete != null) rows.add(this.delete); if (this.increment != null) rows.add(this.increment); return new Mutations(rows, this.qualifierMap); }
private int comparePuts(Put p1, Put p2) { int p1Size = p1.size(); int p2Size = p2.size(); int compare = p1Size - p2Size; if (compare == 0) { // TODO: make this a real comparison // this is a little cheating, but we don't really need to worry too much about this being // the same - chances are that exact matches here are really the same update. return Longs.compare(p1.heapSize(), p2.heapSize()); } return compare; }
private int comparePuts(Put p1, Put p2) { int p1Size = p1.size(); int p2Size = p2.size(); int compare = p1Size - p2Size; if (compare == 0) { // TODO: make this a real comparison // this is a little cheating, but we don't really need to worry too much about this being // the same - chances are that exact matches here are really the same update. return Longs.compare(p1.heapSize(), p2.heapSize()); } return compare; }
field.schema(), hcol, hcol.getQualifier()); if (put.size() > 0) { table.put(put);
HRegion region = c.getEnvironment().getRegion(); List<KeyValue> kvs = put.getFamilyMap().get(ColumnUtil.LOCK_FAMILY_NAME); if (kvs.size() != put.size() || kvs.size() == 0) { throw new IOException( "contain no-lock family kvs when do prewrite for single row transaction, put=" + put);
table.delete(delete); if (put.size() > 0) { table.put(put);
@Override public void write(final DataOutput out) throws IOException { ProtobufUtil.toMutationNoData(MutationType.PUT, put).writeDelimitedTo(DataOutputOutputStream.from(out)); out.writeInt(put.size()); CellScanner scanner = put.cellScanner(); while(scanner.advance()) { KeyValue kv = KeyValueUtil.ensureKeyValue(scanner.current()); KeyValue.write(kv, out); } } }
} else if (obj instanceof Put) { quantities.increment("Put", 1); quantities.increment("KeyValue", ((Put)obj).size()); for (List<KeyValue> keyValues : ((Put)obj).getFamilyMap().values()) { for (KeyValue kv : keyValues) {
put.addColumn(CONTENTS_FAMILY, null, value); assertEquals(1, put.size()); assertEquals(1, put.getFamilyCellMap().get(CONTENTS_FAMILY).size());
public void prepareTestData() throws Exception { try { util.getAdmin().disableTable(TABLE); util.getAdmin().deleteTable(TABLE); } catch (Exception e) { // ignore table not found } table = util.createTable(TABLE, FAM); { Put put = new Put(ROW); put.addColumn(FAM, A, Bytes.add(B, C)); // B, C are friends of A put.addColumn(FAM, B, Bytes.add(D, E, F)); // D, E, F are friends of B put.addColumn(FAM, C, G); // G is a friend of C table.put(put); rowSize = put.size(); } Put put = new Put(ROW2); put.addColumn(FAM, D, E); put.addColumn(FAM, F, G); table.put(put); row2Size = put.size(); }
public void prepareTestData() throws Exception { try { util.getAdmin().disableTable(TABLE); util.getAdmin().deleteTable(TABLE); } catch (Exception e) { // ignore table not found } table = util.createTable(TABLE, FAM); { Put put = new Put(ROW); put.addColumn(FAM, A, Bytes.add(B, C)); // B, C are friends of A put.addColumn(FAM, B, Bytes.add(D, E, F)); // D, E, F are friends of B put.addColumn(FAM, C, G); // G is a friend of C table.put(put); rowSize = put.size(); } Put put = new Put(ROW2); put.addColumn(FAM, D, E); put.addColumn(FAM, F, G); table.put(put); row2Size = put.size(); }