本文整理了Java中org.apache.hadoop.hbase.client.Append.add()
方法的一些代码示例,展示了Append.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Append.add()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Append
类名称:Append
方法名:add
[英]Add column and value to this Append operation.
[中]将列和值添加到此追加操作。
代码示例来源:origin: apache/hbase
/**
* Add the specified column and value to this Append operation.
* @param family family name
* @param qualifier column qualifier
* @param value value to append to specified column
* @return this
*/
public Append addColumn(byte[] family, byte[] qualifier, byte[] value) {
KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
return add(kv);
}
代码示例来源:origin: apache/hbase
@Test
public void testAppendCopyConstructor() throws IOException {
Append origin = new Append(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(Type.Put)
.setValue(Bytes.toBytes(100))
.build());
origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
origin.setTimeRange(100, 1000);
Append clone = new Append(origin);
assertEquals(origin, clone);
origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
//They should have different cell lists
assertNotEquals(origin.getCellList(family), clone.getCellList(family));
}
代码示例来源:origin: apache/hbase
@Override
public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append)
throws IOException {
append.add(createCustomCell(append));
COUNT.incrementAndGet();
return null;
}
代码示例来源:origin: apache/hbase
append.add(new KeyValue(row3, f, q, 1234L, v));
append.setAttribute("visibility", Bytes.toBytes("tag2"));
table.append(append);
table.put(put);
append = new Append(row4);
append.add(new KeyValue(row4, f, q, 1234L, v));
append.setAttribute("visibility", Bytes.toBytes("tag2"));
table.append(append);
代码示例来源:origin: apache/hbase
.build();
append.add(parts[0], parts[1], cell.getValue());
代码示例来源:origin: org.apache.hbase/hbase-client
@Test
public void testAppendCopyConstructor() throws IOException {
Append origin = new Append(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(Type.Put)
.setValue(Bytes.toBytes(100))
.build());
origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
origin.setTimeRange(100, 1000);
Append clone = new Append(origin);
assertEquals(origin, clone);
origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
//They should have different cell lists
assertNotEquals(origin.getCellList(family), clone.getCellList(family));
}
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Add the specified column and value to this Append operation.
* @param family family name
* @param qualifier column qualifier
* @param value value to append to specified column
* @return this
*/
public Append addColumn(byte[] family, byte[] qualifier, byte[] value) {
KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
return add(kv);
}
代码示例来源:origin: org.apache.hbase/hbase-server
append.add(new KeyValue(row3, f, q, 1234L, v));
append.setAttribute("visibility", Bytes.toBytes("tag2"));
table.append(append);
table.put(put);
append = new Append(row4);
append.add(new KeyValue(row4, f, q, 1234L, v));
append.setAttribute("visibility", Bytes.toBytes("tag2"));
table.append(append);
代码示例来源:origin: apache/hbase
@Test
public void testAppendWithCustomTimestamp() throws IOException {
TableName TABLENAME = TableName.valueOf(name.getMethodName());
Table table = TEST_UTIL.createTable(TABLENAME, FAMILY);
long timestamp = 999;
Append append = new Append(ROW);
append.add(CellUtil.createCell(ROW, FAMILY, QUALIFIER, timestamp, KeyValue.Type.Put.getCode(), Bytes.toBytes(100L)));
Result r = table.append(append);
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.append(append);
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: larsgeorge/hbase-book
append.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"),
Bytes.toBytes("newvalue"));
append.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"),
Bytes.toBytes("anothervalue"));
代码示例来源:origin: larsgeorge/hbase-book
append.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual15"),
Bytes.toBytes("-valnew"));
table.append(append);
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Add the specified column and value to this Append operation.
* @param family family name
* @param qualifier column qualifier
* @param value value to append to specified column
* @return this
*/
public Append addColumn(byte[] family, byte[] qualifier, byte[] value) {
KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
return add(kv);
}
代码示例来源:origin: harbby/presto-connectors
/**
* Add the specified column and value to this Append operation.
* @param family family name
* @param qualifier column qualifier
* @param value value to append to specified column
* @return this
*/
public Append add(byte [] family, byte [] qualifier, byte [] value) {
KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
return add(kv);
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Override
public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append)
throws IOException {
append.add(createCustomCell(append));
COUNT.incrementAndGet();
return null;
}
代码示例来源:origin: opencb/opencga
private void appendToken(String token, long lockDuration, byte[] row, byte[] qualifier) throws IOException {
HBaseManager.act(getConnection(), tableName, table -> {
Append a = new Append(row);
byte[] columnFamily = getColumnFamily();
a.add(columnFamily, qualifier,
Bytes.toBytes(
token
+ LOCK_EXPIRING_DATE_SEPARATOR
+ (System.currentTimeMillis() + lockDuration)
+ LOCK_SEPARATOR));
table.append(a);
});
}
代码示例来源:origin: apache/apex-malhar
@Override
public Append operationAppend(HBaseTuple t)
{
Append append = new Append(t.getRow().getBytes());
append.add(t.getColFamily().getBytes(), t.getColName().getBytes(), t.getColValue().getBytes());
return append;
}
代码示例来源:origin: org.apache.hbase/hbase-rest
.build();
append.add(parts[0], parts[1], cell.getValue());
代码示例来源:origin: com.aliyun.hbase/alihbase-rest
.build();
append.add(parts[0], parts[1], cell.getValue());
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testAppendWithCustomTimestamp() throws IOException {
TableName TABLENAME = TableName.valueOf(name.getMethodName());
Table table = TEST_UTIL.createTable(TABLENAME, FAMILY);
long timestamp = 999;
Append append = new Append(ROW);
append.add(CellUtil.createCell(ROW, FAMILY, QUALIFIER, timestamp, KeyValue.Type.Put.getCode(), Bytes.toBytes(100L)));
Result r = table.append(append);
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.append(append);
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
append = new Append(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
append.add(cell);
tags = qv.getTags().toByteArray();
append.add(CellUtil.createCell(row, family, qualifier, qv.getTimestamp(),
KeyValue.Type.Put, value, tags));
内容来源于网络,如有侵权,请联系作者删除!