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

x33g5p2x  于2022-01-21 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(166)

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

Increment.setReturnResults介绍

暂无

代码示例

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

  1. increment.setReturnResults(returnResult);
  2. int i = 0;
  3. for (CellModel cell: rowModel.getCells()) {

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

  1. @Test
  2. public void testBatchIncrementsWithReturnResultFalse() throws Exception {
  3. LOG.info("Starting testBatchIncrementsWithReturnResultFalse");
  4. final TableName tableName = TableName.valueOf(name.getMethodName());
  5. Table table = TEST_UTIL.createTable(tableName, FAMILY);
  6. Increment inc1 = new Increment(Bytes.toBytes("row2"));
  7. inc1.setReturnResults(false);
  8. inc1.addColumn(FAMILY, Bytes.toBytes("f1"), 1);
  9. Increment inc2 = new Increment(Bytes.toBytes("row2"));
  10. inc2.setReturnResults(false);
  11. inc2.addColumn(FAMILY, Bytes.toBytes("f1"), 1);
  12. List<Increment> incs = new ArrayList<>();
  13. incs.add(inc1);
  14. incs.add(inc2);
  15. Object[] results = new Object[2];
  16. table.batch(incs, results);
  17. assertTrue(results.length == 2);
  18. for(Object r : results) {
  19. Result result = (Result)r;
  20. assertTrue(result.isEmpty());
  21. }
  22. table.close();
  23. }

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

  1. /**
  2. * Test when returnResults set to false in increment it should not return the result instead it
  3. * resturn null.
  4. */
  5. @Test
  6. public void testIncrementWithReturnResultsSetToFalse() throws Exception {
  7. byte[] row1 = Bytes.toBytes("row1");
  8. byte[] col1 = Bytes.toBytes("col1");
  9. // Setting up region
  10. WALFactory wals = new WALFactory(CONF,
  11. ServerName
  12. .valueOf("testIncrementWithReturnResultsSetToFalse", 16010, System.currentTimeMillis())
  13. .toString());
  14. HRegion region = createHRegion(wals, Durability.USE_DEFAULT);
  15. Increment inc1 = new Increment(row1);
  16. inc1.setReturnResults(false);
  17. inc1.addColumn(FAMILY, col1, 1);
  18. Result res = region.increment(inc1);
  19. assertTrue(res.isEmpty());
  20. }

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

  1. @Test
  2. public void testIncrement() throws Exception {
  3. testAppend(new Increment(ROW_A).addColumn(TEST_FAMILY, qualifierCol1, 10L));
  4. testAppend(new Increment(ROW_A).addColumn(TEST_FAMILY, qualifierCol1, 10L)
  5. .setReturnResults(false));
  6. }

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

  1. public static Increment incrementFromThrift(TIncrement in) throws IOException {
  2. Increment out = new Increment(in.getRow());
  3. for (TColumnIncrement column : in.getColumns()) {
  4. out.addColumn(column.getFamily(), column.getQualifier(), column.getAmount());
  5. }
  6. if (in.isSetAttributes()) {
  7. addAttributes(out,in.getAttributes());
  8. }
  9. if (in.isSetDurability()) {
  10. out.setDurability(durabilityFromThrift(in.getDurability()));
  11. }
  12. if(in.getCellVisibility() != null) {
  13. out.setCellVisibility(new CellVisibility(in.getCellVisibility().getExpression()));
  14. }
  15. if (in.isSetReturnResults()) {
  16. out.setReturnResults(in.isReturnResults());
  17. }
  18. return out;
  19. }

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

  1. @Test
  2. public void testBatchIncrementsWithReturnResultFalse() throws Exception {
  3. LOG.info("Starting testBatchIncrementsWithReturnResultFalse");
  4. final TableName tableName = TableName.valueOf(name.getMethodName());
  5. Table table = TEST_UTIL.createTable(tableName, FAMILY);
  6. Increment inc1 = new Increment(Bytes.toBytes("row2"));
  7. inc1.setReturnResults(false);
  8. inc1.addColumn(FAMILY, Bytes.toBytes("f1"), 1);
  9. Increment inc2 = new Increment(Bytes.toBytes("row2"));
  10. inc2.setReturnResults(false);
  11. inc2.addColumn(FAMILY, Bytes.toBytes("f1"), 1);
  12. List<Increment> incs = new ArrayList<>();
  13. incs.add(inc1);
  14. incs.add(inc2);
  15. Object[] results = new Object[2];
  16. table.batch(incs, results);
  17. assertTrue(results.length == 2);
  18. for(Object r : results) {
  19. Result result = (Result)r;
  20. assertTrue(result.isEmpty());
  21. }
  22. table.close();
  23. }

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

  1. increment.setReturnResults(returnResult);
  2. int i = 0;
  3. for (CellModel cell: rowModel.getCells()) {

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

  1. increment.setReturnResults(returnResult);
  2. int i = 0;
  3. for (CellModel cell: rowModel.getCells()) {

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

  1. /**
  2. * Test when returnResults set to false in increment it should not return the result instead it
  3. * resturn null.
  4. */
  5. @Test
  6. public void testIncrementWithReturnResultsSetToFalse() throws Exception {
  7. byte[] row1 = Bytes.toBytes("row1");
  8. byte[] col1 = Bytes.toBytes("col1");
  9. // Setting up region
  10. WALFactory wals = new WALFactory(CONF,
  11. ServerName
  12. .valueOf("testIncrementWithReturnResultsSetToFalse", 16010, System.currentTimeMillis())
  13. .toString());
  14. HRegion region = createHRegion(wals, Durability.USE_DEFAULT);
  15. Increment inc1 = new Increment(row1);
  16. inc1.setReturnResults(false);
  17. inc1.addColumn(FAMILY, col1, 1);
  18. Result res = region.increment(inc1);
  19. assertTrue(res.isEmpty());
  20. }

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

  1. @Test
  2. public void testIncrement() throws Exception {
  3. testAppend(new Increment(ROW_A).addColumn(TEST_FAMILY, qualifierCol1, 10L));
  4. testAppend(new Increment(ROW_A).addColumn(TEST_FAMILY, qualifierCol1, 10L)
  5. .setReturnResults(false));
  6. }

相关文章