• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TIncrement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.thrift2.generated.TIncrement的典型用法代码示例。如果您正苦于以下问题:Java TIncrement类的具体用法?Java TIncrement怎么用?Java TIncrement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TIncrement类属于org.apache.hadoop.hbase.thrift2.generated包,在下文中一共展示了TIncrement类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: incrementFromThrift

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
public static Increment incrementFromThrift(TIncrement in) throws IOException {
  Increment out = new Increment(in.getRow());
  for (TColumnIncrement column : in.getColumns()) {
    out.addColumn(column.getFamily(), column.getQualifier(), column.getAmount());
  }

  if (in.isSetAttributes()) {
    addAttributes(out,in.getAttributes());
  }

  if (in.isSetDurability()) {
    out.setDurability(durabilityFromThrift(in.getDurability()));
  }
  
  if(in.getCellVisibility() != null) {
    out.setCellVisibility(new CellVisibility(in.getCellVisibility().getExpression()));
  }

  return out;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:ThriftUtilities.java


示例2: testIncrement

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
@Test
public void testIncrement() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = "testIncrement".getBytes();
  ByteBuffer table = wrap(tableAname);

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
    wrap(Bytes.toBytes(1L))));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  handler.put(table, put);

  List<TColumnIncrement> incrementColumns = new ArrayList<TColumnIncrement>();
  incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname)));
  TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);
  handler.increment(table, increment);

  TGet get = new TGet(wrap(rowName));
  TResult result = handler.get(table, get);

  assertArrayEquals(rowName, result.getRow());
  assertEquals(1, result.getColumnValuesSize());
  TColumnValue columnValue = result.getColumnValues().get(0);
  assertArrayEquals(Bytes.toBytes(2L), columnValue.getValue());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:TestThriftHBaseServiceHandler.java


示例3: incrementFromThrift

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
public static Increment incrementFromThrift(TIncrement in) throws IOException {
  Increment out = new Increment(in.getRow());
  for (TColumnIncrement column : in.getColumns()) {
    out.addColumn(column.getFamily(), column.getQualifier(), column.getAmount());
  }

  if (in.isSetAttributes()) {
    addAttributes(out,in.getAttributes());
  }

  if (in.isSetDurability()) {
    out.setDurability(durabilityFromThrift(in.getDurability()));
  }

  if(in.getCellVisibility() != null) {
    out.setCellVisibility(new CellVisibility(in.getCellVisibility().getExpression()));
  }

  return out;
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:ThriftUtilities.java


示例4: testIncrementWithReadOnly

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
@Test
public void testIncrementWithReadOnly() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = Bytes.toBytes("testIncrement");
  ByteBuffer table = wrap(tableAname);

  List<TColumnIncrement> incrementColumns = new ArrayList<>(1);
  incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname)));
  TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);

  boolean exceptionCaught = false;
  try {
    handler.increment(table, increment);
  } catch (TIOError e) {
    exceptionCaught = true;
    assertTrue(e.getCause() instanceof DoNotRetryIOException);
    assertEquals("Thrift Server is in Read-only mode.", e.getMessage());
  } finally {
    assertTrue(exceptionCaught);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java


示例5: testIncrement

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
@Test
public void testIncrement() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = Bytes.toBytes("testIncrement");
  ByteBuffer table = wrap(tableAname);

  List<TColumnValue> columnValues = new ArrayList<>(1);
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
    wrap(Bytes.toBytes(1L))));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  handler.put(table, put);

  List<TColumnIncrement> incrementColumns = new ArrayList<>(1);
  incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname)));
  TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);
  handler.increment(table, increment);

  TGet get = new TGet(wrap(rowName));
  TResult result = handler.get(table, get);

  assertArrayEquals(rowName, result.getRow());
  assertEquals(1, result.getColumnValuesSize());
  TColumnValue columnValue = result.getColumnValues().get(0);
  assertArrayEquals(Bytes.toBytes(2L), columnValue.getValue());
}
 
开发者ID:apache,项目名称:hbase,代码行数:27,代码来源:TestThriftHBaseServiceHandler.java


示例6: testIncrement

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
@Test
public void testIncrement() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = "testIncrement".getBytes();
  ByteBuffer table = ByteBuffer.wrap(tableAname);

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyAname), ByteBuffer.wrap(qualifierAname), ByteBuffer
      .wrap(Bytes.toBytes(1L))));
  TPut put = new TPut(ByteBuffer.wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  handler.put(table, put);

  List<TColumnIncrement> incrementColumns = new ArrayList<TColumnIncrement>();
  incrementColumns.add(new TColumnIncrement(ByteBuffer.wrap(familyAname), ByteBuffer.wrap(qualifierAname)));
  TIncrement increment = new TIncrement(ByteBuffer.wrap(rowName), incrementColumns);
  handler.increment(table, increment);

  TGet get = new TGet(ByteBuffer.wrap(rowName));
  TResult result = handler.get(table, get);

  assertArrayEquals(rowName, result.getRow());
  assertEquals(1, result.getColumnValuesSize());
  TColumnValue columnValue = result.getColumnValues().get(0);
  assertArrayEquals(Bytes.toBytes(2L), columnValue.getValue());
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:27,代码来源:TestThriftHBaseServiceHandler.java


示例7: testIncrementWithTags

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
@Test
public void testIncrementWithTags() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = "testIncrementWithTags".getBytes();
  ByteBuffer table = wrap(tableAname);

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
      wrap(Bytes.toBytes(1L))));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE));
  handler.put(table, put);

  List<TColumnIncrement> incrementColumns = new ArrayList<TColumnIncrement>();
  incrementColumns.add(new TColumnIncrement(wrap(familyAname),
      wrap(qualifierAname)));
  TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);
  increment.setCellVisibility(new TCellVisibility().setExpression(SECRET));
  handler.increment(table, increment);

  TGet get = new TGet(wrap(rowName));
  TAuthorization tauth = new TAuthorization();
  List<String> labels = new ArrayList<String>();
  labels.add(SECRET);
  tauth.setLabels(labels);
  get.setAuthorizations(tauth);
  TResult result = handler.get(table, get);

  assertArrayEquals(rowName, result.getRow());
  assertEquals(1, result.getColumnValuesSize());
  TColumnValue columnValue = result.getColumnValues().get(0);
  assertArrayEquals(Bytes.toBytes(2L), columnValue.getValue());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:TestThriftHBaseServiceHandlerWithLabels.java


示例8: testIncrementWithTagsWithNotMatchLabels

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
@Test
public void testIncrementWithTagsWithNotMatchLabels() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = "testIncrementWithTagsWithNotMatchLabels".getBytes();
  ByteBuffer table = wrap(tableAname);

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
      wrap(Bytes.toBytes(1L))));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE));
  handler.put(table, put);

  List<TColumnIncrement> incrementColumns = new ArrayList<TColumnIncrement>();
  incrementColumns.add(new TColumnIncrement(wrap(familyAname),
      wrap(qualifierAname)));
  TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);
  increment.setCellVisibility(new TCellVisibility().setExpression(SECRET));
  handler.increment(table, increment);

  TGet get = new TGet(wrap(rowName));
  TAuthorization tauth = new TAuthorization();
  List<String> labels = new ArrayList<String>();
  labels.add(PUBLIC);
  tauth.setLabels(labels);
  get.setAuthorizations(tauth);
  TResult result = handler.get(table, get);
  assertNull(result.getRow());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:TestThriftHBaseServiceHandlerWithLabels.java


示例9: testIncrementWithTags

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
@Test
public void testIncrementWithTags() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = Bytes.toBytes("testIncrementWithTags");
  ByteBuffer table = wrap(tableAname);

  List<TColumnValue> columnValues = new ArrayList<>(1);
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
      wrap(Bytes.toBytes(1L))));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE));
  handler.put(table, put);

  List<TColumnIncrement> incrementColumns = new ArrayList<>(1);
  incrementColumns.add(new TColumnIncrement(wrap(familyAname),
      wrap(qualifierAname)));
  TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);
  increment.setCellVisibility(new TCellVisibility().setExpression(SECRET));
  handler.increment(table, increment);

  TGet get = new TGet(wrap(rowName));
  TAuthorization tauth = new TAuthorization();
  List<String> labels = new ArrayList<>(1);
  labels.add(SECRET);
  tauth.setLabels(labels);
  get.setAuthorizations(tauth);
  TResult result = handler.get(table, get);

  assertArrayEquals(rowName, result.getRow());
  assertEquals(1, result.getColumnValuesSize());
  TColumnValue columnValue = result.getColumnValues().get(0);
  assertArrayEquals(Bytes.toBytes(2L), columnValue.getValue());
}
 
开发者ID:apache,项目名称:hbase,代码行数:35,代码来源:TestThriftHBaseServiceHandlerWithLabels.java


示例10: testIncrementWithTagsWithNotMatchLabels

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
@Test
public void testIncrementWithTagsWithNotMatchLabels() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = Bytes.toBytes("testIncrementWithTagsWithNotMatchLabels");
  ByteBuffer table = wrap(tableAname);

  List<TColumnValue> columnValues = new ArrayList<>(1);
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
      wrap(Bytes.toBytes(1L))));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE));
  handler.put(table, put);

  List<TColumnIncrement> incrementColumns = new ArrayList<>(1);
  incrementColumns.add(new TColumnIncrement(wrap(familyAname),
      wrap(qualifierAname)));
  TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);
  increment.setCellVisibility(new TCellVisibility().setExpression(SECRET));
  handler.increment(table, increment);

  TGet get = new TGet(wrap(rowName));
  TAuthorization tauth = new TAuthorization();
  List<String> labels = new ArrayList<>(1);
  labels.add(PUBLIC);
  tauth.setLabels(labels);
  get.setAuthorizations(tauth);
  TResult result = handler.get(table, get);
  assertNull(result.getRow());
}
 
开发者ID:apache,项目名称:hbase,代码行数:31,代码来源:TestThriftHBaseServiceHandlerWithLabels.java


示例11: testDurability

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
/**
 * Create TPut, TDelete , TIncrement objects, set durability then call ThriftUtility
 * functions to get Put , Delete and Increment respectively. Use getDurability to make sure
 * the returned objects have the appropriate durability setting.
 *
 * @throws Exception
 */
@Test
public void testDurability() throws Exception {
  byte[] rowName = "testDurability".getBytes();
  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));

  List<TColumnIncrement> incrementColumns = new ArrayList<TColumnIncrement>();
  incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname)));

  TDelete tDelete = new TDelete(wrap(rowName));
  tDelete.setDurability(TDurability.SKIP_WAL);
  Delete delete = deleteFromThrift(tDelete);
  assertEquals(delete.getDurability(), Durability.SKIP_WAL);

  tDelete.setDurability(TDurability.ASYNC_WAL);
  delete = deleteFromThrift(tDelete);
  assertEquals(delete.getDurability(), Durability.ASYNC_WAL);

  tDelete.setDurability(TDurability.SYNC_WAL);
  delete = deleteFromThrift(tDelete);
  assertEquals(delete.getDurability(), Durability.SYNC_WAL);

  tDelete.setDurability(TDurability.FSYNC_WAL);
  delete = deleteFromThrift(tDelete);
  assertEquals(delete.getDurability(), Durability.FSYNC_WAL);

  TPut tPut = new TPut(wrap(rowName), columnValues);
  tPut.setDurability(TDurability.SKIP_WAL);
  Put put = putFromThrift(tPut);
  assertEquals(put.getDurability(), Durability.SKIP_WAL);

  tPut.setDurability(TDurability.ASYNC_WAL);
  put = putFromThrift(tPut);
  assertEquals(put.getDurability(), Durability.ASYNC_WAL);

  tPut.setDurability(TDurability.SYNC_WAL);
  put = putFromThrift(tPut);
  assertEquals(put.getDurability(), Durability.SYNC_WAL);

  tPut.setDurability(TDurability.FSYNC_WAL);
  put = putFromThrift(tPut);
  assertEquals(put.getDurability(), Durability.FSYNC_WAL);

  TIncrement tIncrement = new TIncrement(wrap(rowName), incrementColumns);

  tIncrement.setDurability(TDurability.SKIP_WAL);
  Increment increment = incrementFromThrift(tIncrement);
  assertEquals(increment.getDurability(), Durability.SKIP_WAL);

  tIncrement.setDurability(TDurability.ASYNC_WAL);
  increment = incrementFromThrift(tIncrement);
  assertEquals(increment.getDurability(), Durability.ASYNC_WAL);

  tIncrement.setDurability(TDurability.SYNC_WAL);
  increment = incrementFromThrift(tIncrement);
  assertEquals(increment.getDurability(), Durability.SYNC_WAL);

  tIncrement.setDurability(TDurability.FSYNC_WAL);
  increment = incrementFromThrift(tIncrement);
  assertEquals(increment.getDurability(), Durability.FSYNC_WAL);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:69,代码来源:TestThriftHBaseServiceHandler.java


示例12: testDurability

import org.apache.hadoop.hbase.thrift2.generated.TIncrement; //导入依赖的package包/类
/**
 * Create TPut, TDelete , TIncrement objects, set durability then call ThriftUtility
 * functions to get Put , Delete and Increment respectively. Use getDurability to make sure
 * the returned objects have the appropriate durability setting.
 */
@Test
public void testDurability() throws Exception {
  byte[] rowName = Bytes.toBytes("testDurability");
  List<TColumnValue> columnValues = new ArrayList<>(1);
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));

  List<TColumnIncrement> incrementColumns = new ArrayList<>(1);
  incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname)));

  TDelete tDelete = new TDelete(wrap(rowName));
  tDelete.setDurability(TDurability.SKIP_WAL);
  Delete delete = deleteFromThrift(tDelete);
  assertEquals(Durability.SKIP_WAL, delete.getDurability());

  tDelete.setDurability(TDurability.ASYNC_WAL);
  delete = deleteFromThrift(tDelete);
  assertEquals(Durability.ASYNC_WAL, delete.getDurability());

  tDelete.setDurability(TDurability.SYNC_WAL);
  delete = deleteFromThrift(tDelete);
  assertEquals(Durability.SYNC_WAL, delete.getDurability());

  tDelete.setDurability(TDurability.FSYNC_WAL);
  delete = deleteFromThrift(tDelete);
  assertEquals(Durability.FSYNC_WAL, delete.getDurability());

  TPut tPut = new TPut(wrap(rowName), columnValues);
  tPut.setDurability(TDurability.SKIP_WAL);
  Put put = putFromThrift(tPut);
  assertEquals(Durability.SKIP_WAL, put.getDurability());

  tPut.setDurability(TDurability.ASYNC_WAL);
  put = putFromThrift(tPut);
  assertEquals(Durability.ASYNC_WAL, put.getDurability());

  tPut.setDurability(TDurability.SYNC_WAL);
  put = putFromThrift(tPut);
  assertEquals(Durability.SYNC_WAL, put.getDurability());

  tPut.setDurability(TDurability.FSYNC_WAL);
  put = putFromThrift(tPut);
  assertEquals(Durability.FSYNC_WAL, put.getDurability());

  TIncrement tIncrement = new TIncrement(wrap(rowName), incrementColumns);

  tIncrement.setDurability(TDurability.SKIP_WAL);
  Increment increment = incrementFromThrift(tIncrement);
  assertEquals(Durability.SKIP_WAL, increment.getDurability());

  tIncrement.setDurability(TDurability.ASYNC_WAL);
  increment = incrementFromThrift(tIncrement);
  assertEquals(Durability.ASYNC_WAL, increment.getDurability());

  tIncrement.setDurability(TDurability.SYNC_WAL);
  increment = incrementFromThrift(tIncrement);
  assertEquals(Durability.SYNC_WAL, increment.getDurability());

  tIncrement.setDurability(TDurability.FSYNC_WAL);
  increment = incrementFromThrift(tIncrement);
  assertEquals(Durability.FSYNC_WAL, increment.getDurability());
}
 
开发者ID:apache,项目名称:hbase,代码行数:67,代码来源:TestThriftHBaseServiceHandler.java



注:本文中的org.apache.hadoop.hbase.thrift2.generated.TIncrement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TransformerImpl类代码示例发布时间:2022-05-22
下一篇:
Java PullToRefreshView类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap