本文整理了Java中org.apache.hadoop.hbase.client.Increment.add()
方法的一些代码示例,展示了Increment.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Increment.add()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Increment
类名称:Increment
方法名:add
[英]Add the specified KeyValue to this operation.
[中]将指定的KeyValue添加到此操作。
代码示例来源:origin: apache/hbase
@Override
public Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment)
throws IOException {
increment.add(createCustomCell(increment));
COUNT.incrementAndGet();
return null;
}
代码示例来源:origin: apache/hbase
@Test
public void testIncrementCopyConstructor() throws IOException {
Increment origin = new Increment(Bytes.toBytes("ROW-01"));
origin.setPriority(100);
byte[] family = Bytes.toBytes("CF-01");
origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
.setRow(origin.getRow())
.setFamily(family)
.setQualifier(Bytes.toBytes("q"))
.setType(Cell.Type.Put)
.setValue(Bytes.toBytes(100))
.build());
origin.addColumn(family, Bytes.toBytes("q0"), 4);
origin.setTimeRange(100, 1000);
Increment clone = new Increment(origin);
assertEquals(origin, clone);
origin.addColumn(family, Bytes.toBytes("q1"), 3);
//They should have different cell lists
assertNotEquals(origin.getCellList(family), clone.getCellList(family));
}
代码示例来源:origin: apache/hbase
increment.add(new KeyValue(row1, f, q, 1234L, v));
increment.setAttribute("visibility", Bytes.toBytes("tag2"));
table.increment(increment);
table.put(put);
increment = new Increment(row2);
increment.add(new KeyValue(row2, f, q, 1234L, v));
increment.setAttribute("visibility", Bytes.toBytes("tag2"));
table.increment(increment);
代码示例来源:origin: apache/hbase
@Test
public void testIncrementWithCustomTimestamp() throws IOException {
TableName TABLENAME = TableName.valueOf(name.getMethodName());
Table table = TEST_UTIL.createTable(TABLENAME, FAMILY);
long timestamp = 999;
Increment increment = new Increment(ROW);
increment.add(CellUtil.createCell(ROW, FAMILY, QUALIFIER, timestamp, KeyValue.Type.Put.getCode(), Bytes.toBytes(100L)));
Result r = table.increment(increment);
assertEquals(1, r.size());
assertEquals(timestamp, r.rawCells()[0].getTimestamp());
r = table.get(new Get(ROW));
assertEquals(1, r.size());
assertEquals(timestamp, r.rawCells()[0].getTimestamp());
r = table.increment(increment);
assertEquals(1, r.size());
assertNotEquals(timestamp, r.rawCells()[0].getTimestamp());
r = table.get(new Get(ROW));
assertEquals(1, r.size());
assertNotEquals(timestamp, r.rawCells()[0].getTimestamp());
}
代码示例来源:origin: org.apache.hbase/hbase-client
@Test
public void testIncrementCopyConstructor() throws IOException {
Increment origin = new Increment(Bytes.toBytes("ROW-01"));
origin.setPriority(100);
byte[] family = Bytes.toBytes("CF-01");
origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
.setRow(origin.getRow())
.setFamily(family)
.setQualifier(Bytes.toBytes("q"))
.setType(Cell.Type.Put)
.setValue(Bytes.toBytes(100))
.build());
origin.addColumn(family, Bytes.toBytes("q0"), 4);
origin.setTimeRange(100, 1000);
Increment clone = new Increment(origin);
assertEquals(origin, clone);
origin.addColumn(family, Bytes.toBytes("q1"), 3);
//They should have different cell lists
assertNotEquals(origin.getCellList(family), clone.getCellList(family));
}
代码示例来源:origin: apache/phoenix
KeyValue.Type.Put,
incValue, 0, incValue.length);
inc.add(cell);
} catch (IOException e) {
throw new RuntimeException(e); // Impossible
代码示例来源:origin: org.apache.hbase/hbase-server
increment.add(new KeyValue(row1, f, q, 1234L, v));
increment.setAttribute("visibility", Bytes.toBytes("tag2"));
table.increment(increment);
table.put(put);
increment = new Increment(row2);
increment.add(new KeyValue(row2, f, q, 1234L, v));
increment.setAttribute("visibility", Bytes.toBytes("tag2"));
table.increment(increment);
代码示例来源:origin: org.apache.hbase/hbase-server
@Override
public Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment)
throws IOException {
increment.add(createCustomCell(increment));
COUNT.incrementAndGet();
return null;
}
代码示例来源:origin: co.cask.cdap/cdap-hbase-compat-base
@Override
public IncrementBuilder add(byte[] family, byte[] qualifier, long ts, long value) throws IOException {
increment.add(new KeyValue(increment.getRow(), family, qualifier, ts, Bytes.toBytes(value)));
return this;
}
代码示例来源:origin: cdapio/cdap
@Override
public IncrementBuilder add(byte[] family, byte[] qualifier, long ts, long value) throws IOException {
increment.add(new KeyValue(increment.getRow(), family, qualifier, ts, Bytes.toBytes(value)));
return this;
}
代码示例来源:origin: org.apache.phoenix/phoenix-core
KeyValue.Type.Put,
incValue, 0, incValue.length);
inc.add(cell);
} catch (IOException e) {
throw new RuntimeException(e); // Impossible
代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core
KeyValue.Type.Put,
incValue, 0, incValue.length);
inc.add(cell);
} catch (IOException e) {
throw new RuntimeException(e); // Impossible
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testIncrementWithCustomTimestamp() throws IOException {
TableName TABLENAME = TableName.valueOf(name.getMethodName());
Table table = TEST_UTIL.createTable(TABLENAME, FAMILY);
long timestamp = 999;
Increment increment = new Increment(ROW);
increment.add(CellUtil.createCell(ROW, FAMILY, QUALIFIER, timestamp, KeyValue.Type.Put.getCode(), Bytes.toBytes(100L)));
Result r = table.increment(increment);
assertEquals(1, r.size());
assertEquals(timestamp, r.rawCells()[0].getTimestamp());
r = table.get(new Get(ROW));
assertEquals(1, r.size());
assertEquals(timestamp, r.rawCells()[0].getTimestamp());
r = table.increment(increment);
assertEquals(1, r.size());
assertNotEquals(timestamp, r.rawCells()[0].getTimestamp());
r = table.get(new Get(ROW));
assertEquals(1, r.size());
assertNotEquals(timestamp, r.rawCells()[0].getTimestamp());
}
代码示例来源:origin: harbby/presto-connectors
increment = new Increment(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
increment.add(cell);
tags = qv.getTags().toByteArray();
increment.add(CellUtil.createCell(row, family, qualifier, qv.getTimestamp(),
KeyValue.Type.Put, value, tags));
内容来源于网络,如有侵权,请联系作者删除!