当前位置: 首页>>代码示例>>Java>>正文


Java TPut.setColumnValues方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.thrift2.generated.TPut.setColumnValues方法的典型用法代码示例。如果您正苦于以下问题:Java TPut.setColumnValues方法的具体用法?Java TPut.setColumnValues怎么用?Java TPut.setColumnValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.thrift2.generated.TPut的用法示例。


在下文中一共展示了TPut.setColumnValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testExists

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

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestThriftHBaseServiceHandler.java

示例2: testPutGet

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

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);

  put.setColumnValues(columnValues);

  handler.put(table, put);

  TGet get = new TGet(wrap(rowName));

  TResult result = handler.get(table, get);
  assertArrayEquals(rowName, result.getRow());
  List<TColumnValue> returnedColumnValues = result.getColumnValues();
  assertTColumnValuesEqual(columnValues, returnedColumnValues);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:TestThriftHBaseServiceHandler.java

示例3: testIncrement

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的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

示例4: testAppend

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的package包/类
@Test
public void testAppend() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = "testAppend".getBytes();
  ByteBuffer table = wrap(tableAname);
  byte[] v1 = Bytes.toBytes("42");
  byte[] v2 = Bytes.toBytes("23");
  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(v1)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  handler.put(table, put);

  List<TColumnValue> appendColumns = new ArrayList<TColumnValue>();
  appendColumns.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(v2)));
  TAppend append = new TAppend(wrap(rowName), appendColumns);
  handler.append(table, append);

  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.add(v1, v2), columnValue.getValue());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:TestThriftHBaseServiceHandler.java

示例5: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  ThriftHBaseServiceHandler hbaseHandler = createHandler();
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(hbaseHandler, metrics);
  byte[] rowName = "testMetrics".getBytes();
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),  wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  metricsHelper.assertCounter("put_num_ops", 1, metrics.getSource());
  metricsHelper.assertCounter( "exists_num_ops", 2, metrics.getSource());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:TestThriftHBaseServiceHandler.java

示例6: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(conf, metrics);
  byte[] rowName = "testMetrics".getBytes();
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),  wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  logMetrics(metrics);
  verifyMetrics(metrics, "put_num_ops", 1);
  verifyMetrics(metrics, "exists_num_ops", 2);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:26,代码来源:TestThriftHBaseServiceHandler.java

示例7: testMetrics

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的package包/类
@Test
public void testMetrics() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  ThriftMetrics metrics = getMetrics(conf);
  THBaseService.Iface handler =
      ThriftHBaseServiceHandler.newInstance(conf, metrics);
  byte[] rowName = "testMetrics".getBytes();
  ByteBuffer table = wrap(tableAname);

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),  wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
  metricsHelper.assertCounter("put_num_ops", 1, metrics.getSource());
  metricsHelper.assertCounter( "exists_num_ops", 2, metrics.getSource());
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:25,代码来源:TestThriftHBaseServiceHandler.java

示例8: testExists

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

  TGet get = new TGet(wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<>(2);
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
}
 
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:TestThriftHBaseServiceHandler.java

示例9: testAppend

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的package包/类
@Test
public void testAppend() throws Exception {
  ThriftHBaseServiceHandler handler = createHandler();
  byte[] rowName = Bytes.toBytes("testAppend");
  ByteBuffer table = wrap(tableAname);
  byte[] v1 = Bytes.toBytes("42");
  byte[] v2 = Bytes.toBytes("23");
  List<TColumnValue> columnValues = new ArrayList<>(1);
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(v1)));
  TPut put = new TPut(wrap(rowName), columnValues);
  put.setColumnValues(columnValues);
  handler.put(table, put);

  List<TColumnValue> appendColumns = new ArrayList<>(1);
  appendColumns.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(v2)));
  TAppend append = new TAppend(wrap(rowName), appendColumns);
  handler.append(table, append);

  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.add(v1, v2), columnValue.getValue());
}
 
开发者ID:apache,项目名称:hbase,代码行数:27,代码来源:TestThriftHBaseServiceHandler.java

示例10: testPutGet

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

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyAname), ByteBuffer.wrap(qualifierAname), ByteBuffer
      .wrap(valueAname)));
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyBname), ByteBuffer.wrap(qualifierBname), ByteBuffer
      .wrap(valueBname)));
  TPut put = new TPut(ByteBuffer.wrap(rowName), columnValues);

  put.setColumnValues(columnValues);

  handler.put(table, put);

  TGet get = new TGet(ByteBuffer.wrap(rowName));

  TResult result = handler.get(table, get);
  assertArrayEquals(rowName, result.getRow());
  List<TColumnValue> returnedColumnValues = result.getColumnValues();
  assertTColumnValuesEqual(columnValues, returnedColumnValues);
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:25,代码来源:TestThriftHBaseServiceHandler.java

示例11: testIncrement

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的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

示例12: testExists

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

  TGet get = new TGet(ByteBuffer.wrap(rowName));
  assertFalse(handler.exists(table, get));

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyAname), ByteBuffer.wrap(qualifierAname), ByteBuffer
      .wrap(valueAname)));
  columnValues.add(new TColumnValue(ByteBuffer.wrap(familyBname), ByteBuffer.wrap(qualifierBname), ByteBuffer
      .wrap(valueBname)));
  TPut put = new TPut(ByteBuffer.wrap(rowName), columnValues);
  put.setColumnValues(columnValues);

  handler.put(table, put);

  assertTrue(handler.exists(table, get));
}
 
开发者ID:algarecu,项目名称:hbase-0.94.8-qod,代码行数:22,代码来源:TestThriftHBaseServiceHandler.java

示例13: testGetsWithLabels

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

  List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
  columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
      wrap(valueAname)));
  columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),
      wrap(valueBname)));
  TPut put = new TPut(wrap(rowName), columnValues);

  put.setColumnValues(columnValues);
  put.setCellVisibility(new TCellVisibility().setExpression("(" + SECRET + "|"
      + CONFIDENTIAL + ")" + "&" + "!" + TOPSECRET));
  handler.put(table, put);
  TGet get = new TGet(wrap(rowName));
  TAuthorization tauth = new TAuthorization();
  List<String> labels = new ArrayList<String>();
  labels.add(SECRET);
  labels.add(PRIVATE);
  tauth.setLabels(labels);
  get.setAuthorizations(tauth);
  TResult result = handler.get(table, get);
  assertArrayEquals(rowName, result.getRow());
  List<TColumnValue> returnedColumnValues = result.getColumnValues();
  assertTColumnValuesEqual(columnValues, returnedColumnValues);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:TestThriftHBaseServiceHandlerWithLabels.java

示例14: testIncrementWithTags

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的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

示例15: testIncrementWithTagsWithNotMatchLabels

import org.apache.hadoop.hbase.thrift2.generated.TPut; //导入方法依赖的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


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