org.apache.hadoop.hbase.client.Append.add()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.apache.hadoop.hbase.client.Append.add()方法的一些代码示例,展示了Append.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Append.add()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Append
类名称:Append
方法名:add

Append.add介绍

[英]Add column and value to this Append operation.
[中]将列和值添加到此追加操作。

代码示例

代码示例来源:origin: apache/hbase

  1. /**
  2. * Add the specified column and value to this Append operation.
  3. * @param family family name
  4. * @param qualifier column qualifier
  5. * @param value value to append to specified column
  6. * @return this
  7. */
  8. public Append addColumn(byte[] family, byte[] qualifier, byte[] value) {
  9. KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
  10. return add(kv);
  11. }

代码示例来源:origin: apache/hbase

  1. @Test
  2. public void testAppendCopyConstructor() throws IOException {
  3. Append origin = new Append(Bytes.toBytes("ROW-01"));
  4. origin.setPriority(100);
  5. byte[] family = Bytes.toBytes("CF-01");
  6. origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
  7. .setRow(origin.getRow())
  8. .setFamily(family)
  9. .setQualifier(Bytes.toBytes("q"))
  10. .setType(Type.Put)
  11. .setValue(Bytes.toBytes(100))
  12. .build());
  13. origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
  14. origin.setTimeRange(100, 1000);
  15. Append clone = new Append(origin);
  16. assertEquals(origin, clone);
  17. origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
  18. //They should have different cell lists
  19. assertNotEquals(origin.getCellList(family), clone.getCellList(family));
  20. }

代码示例来源:origin: apache/hbase

  1. @Override
  2. public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append)
  3. throws IOException {
  4. append.add(createCustomCell(append));
  5. COUNT.incrementAndGet();
  6. return null;
  7. }

代码示例来源:origin: apache/hbase

  1. append.add(new KeyValue(row3, f, q, 1234L, v));
  2. append.setAttribute("visibility", Bytes.toBytes("tag2"));
  3. table.append(append);
  4. table.put(put);
  5. append = new Append(row4);
  6. append.add(new KeyValue(row4, f, q, 1234L, v));
  7. append.setAttribute("visibility", Bytes.toBytes("tag2"));
  8. table.append(append);

代码示例来源:origin: apache/hbase

  1. .build();
  2. append.add(parts[0], parts[1], cell.getValue());

代码示例来源:origin: org.apache.hbase/hbase-client

  1. @Test
  2. public void testAppendCopyConstructor() throws IOException {
  3. Append origin = new Append(Bytes.toBytes("ROW-01"));
  4. origin.setPriority(100);
  5. byte[] family = Bytes.toBytes("CF-01");
  6. origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
  7. .setRow(origin.getRow())
  8. .setFamily(family)
  9. .setQualifier(Bytes.toBytes("q"))
  10. .setType(Type.Put)
  11. .setValue(Bytes.toBytes(100))
  12. .build());
  13. origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
  14. origin.setTimeRange(100, 1000);
  15. Append clone = new Append(origin);
  16. assertEquals(origin, clone);
  17. origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
  18. //They should have different cell lists
  19. assertNotEquals(origin.getCellList(family), clone.getCellList(family));
  20. }

代码示例来源:origin: org.apache.hbase/hbase-client

  1. /**
  2. * Add the specified column and value to this Append operation.
  3. * @param family family name
  4. * @param qualifier column qualifier
  5. * @param value value to append to specified column
  6. * @return this
  7. */
  8. public Append addColumn(byte[] family, byte[] qualifier, byte[] value) {
  9. KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
  10. return add(kv);
  11. }

代码示例来源:origin: org.apache.hbase/hbase-server

  1. append.add(new KeyValue(row3, f, q, 1234L, v));
  2. append.setAttribute("visibility", Bytes.toBytes("tag2"));
  3. table.append(append);
  4. table.put(put);
  5. append = new Append(row4);
  6. append.add(new KeyValue(row4, f, q, 1234L, v));
  7. append.setAttribute("visibility", Bytes.toBytes("tag2"));
  8. table.append(append);

代码示例来源:origin: apache/hbase

  1. @Test
  2. public void testAppendWithCustomTimestamp() throws IOException {
  3. TableName TABLENAME = TableName.valueOf(name.getMethodName());
  4. Table table = TEST_UTIL.createTable(TABLENAME, FAMILY);
  5. long timestamp = 999;
  6. Append append = new Append(ROW);
  7. append.add(CellUtil.createCell(ROW, FAMILY, QUALIFIER, timestamp, KeyValue.Type.Put.getCode(), Bytes.toBytes(100L)));
  8. Result r = table.append(append);
  9. assertEquals(1, r.size());
  10. assertEquals(timestamp, r.rawCells()[0].getTimestamp());
  11. r = table.get(new Get(ROW));
  12. assertEquals(1, r.size());
  13. assertEquals(timestamp, r.rawCells()[0].getTimestamp());
  14. r = table.append(append);
  15. assertEquals(1, r.size());
  16. assertNotEquals(timestamp, r.rawCells()[0].getTimestamp());
  17. r = table.get(new Get(ROW));
  18. assertEquals(1, r.size());
  19. assertNotEquals(timestamp, r.rawCells()[0].getTimestamp());
  20. }
  21. }

代码示例来源:origin: larsgeorge/hbase-book

  1. append.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"),
  2. Bytes.toBytes("newvalue"));
  3. append.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"),
  4. Bytes.toBytes("anothervalue"));

代码示例来源:origin: larsgeorge/hbase-book

  1. append.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual15"),
  2. Bytes.toBytes("-valnew"));
  3. table.append(append);

代码示例来源:origin: com.aliyun.hbase/alihbase-client

  1. /**
  2. * Add the specified column and value to this Append operation.
  3. * @param family family name
  4. * @param qualifier column qualifier
  5. * @param value value to append to specified column
  6. * @return this
  7. */
  8. public Append addColumn(byte[] family, byte[] qualifier, byte[] value) {
  9. KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
  10. return add(kv);
  11. }

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Add the specified column and value to this Append operation.
  3. * @param family family name
  4. * @param qualifier column qualifier
  5. * @param value value to append to specified column
  6. * @return this
  7. */
  8. public Append add(byte [] family, byte [] qualifier, byte [] value) {
  9. KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
  10. return add(kv);
  11. }

代码示例来源:origin: org.apache.hbase/hbase-server

  1. @Override
  2. public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append)
  3. throws IOException {
  4. append.add(createCustomCell(append));
  5. COUNT.incrementAndGet();
  6. return null;
  7. }

代码示例来源:origin: opencb/opencga

  1. private void appendToken(String token, long lockDuration, byte[] row, byte[] qualifier) throws IOException {
  2. HBaseManager.act(getConnection(), tableName, table -> {
  3. Append a = new Append(row);
  4. byte[] columnFamily = getColumnFamily();
  5. a.add(columnFamily, qualifier,
  6. Bytes.toBytes(
  7. token
  8. + LOCK_EXPIRING_DATE_SEPARATOR
  9. + (System.currentTimeMillis() + lockDuration)
  10. + LOCK_SEPARATOR));
  11. table.append(a);
  12. });
  13. }

代码示例来源:origin: apache/apex-malhar

  1. @Override
  2. public Append operationAppend(HBaseTuple t)
  3. {
  4. Append append = new Append(t.getRow().getBytes());
  5. append.add(t.getColFamily().getBytes(), t.getColName().getBytes(), t.getColValue().getBytes());
  6. return append;
  7. }

代码示例来源:origin: org.apache.hbase/hbase-rest

  1. .build();
  2. append.add(parts[0], parts[1], cell.getValue());

代码示例来源:origin: com.aliyun.hbase/alihbase-rest

  1. .build();
  2. append.add(parts[0], parts[1], cell.getValue());

代码示例来源:origin: org.apache.hbase/hbase-server

  1. @Test
  2. public void testAppendWithCustomTimestamp() throws IOException {
  3. TableName TABLENAME = TableName.valueOf(name.getMethodName());
  4. Table table = TEST_UTIL.createTable(TABLENAME, FAMILY);
  5. long timestamp = 999;
  6. Append append = new Append(ROW);
  7. append.add(CellUtil.createCell(ROW, FAMILY, QUALIFIER, timestamp, KeyValue.Type.Put.getCode(), Bytes.toBytes(100L)));
  8. Result r = table.append(append);
  9. assertEquals(1, r.size());
  10. assertEquals(timestamp, r.rawCells()[0].getTimestamp());
  11. r = table.get(new Get(ROW));
  12. assertEquals(1, r.size());
  13. assertEquals(timestamp, r.rawCells()[0].getTimestamp());
  14. r = table.append(append);
  15. assertEquals(1, r.size());
  16. assertNotEquals(timestamp, r.rawCells()[0].getTimestamp());
  17. r = table.get(new Get(ROW));
  18. assertEquals(1, r.size());
  19. assertNotEquals(timestamp, r.rawCells()[0].getTimestamp());
  20. }
  21. }

代码示例来源:origin: harbby/presto-connectors

  1. append = new Append(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
  2. append.add(cell);
  3. tags = qv.getTags().toByteArray();
  4. append.add(CellUtil.createCell(row, family, qualifier, qv.getTimestamp(),
  5. KeyValue.Type.Put, value, tags));

相关文章