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


Java HTable.get方法代码示例

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


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

示例1: QueryByCondition1

import org.apache.hadoop.hbase.client.HTable; //导入方法依赖的package包/类
public static void QueryByCondition1(String tableName) {

        HTablePool pool = new HTablePool(configuration, 1000);
        HTable table = (HTable) pool.getTable(tableName);
        try {
            Get scan = new Get("abcdef".getBytes());// 根据rowkey查询
            Result r = table.get(scan);
            System.out.println("获得到rowkey:" + new String(r.getRow()));
            for (KeyValue keyValue : r.raw()) {
                System.out.println("列:" + new String(keyValue.getFamily())
                        + "====值:" + new String(keyValue.getValue()));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
 
开发者ID:yjp123456,项目名称:SparkDemo,代码行数:17,代码来源:MyClass.java

示例2: verifyHBaseCell

import org.apache.hadoop.hbase.client.HTable; //导入方法依赖的package包/类
protected void verifyHBaseCell(String tableName, String rowKey,
    String colFamily, String colName, String val) throws IOException {
  Get get = new Get(Bytes.toBytes(rowKey));
  get.addColumn(Bytes.toBytes(colFamily), Bytes.toBytes(colName));
  HTable table = new HTable(new Configuration(
      hbaseTestUtil.getConfiguration()), Bytes.toBytes(tableName));
  try {
    Result r = table.get(get);
    byte [] actualVal = r.getValue(Bytes.toBytes(colFamily),
        Bytes.toBytes(colName));
    if (null == val) {
      assertNull("Got a result when expected null", actualVal);
    } else {
      assertNotNull("No result, but we expected one", actualVal);
      assertEquals(val, Bytes.toString(actualVal));
    }
  } finally {
    table.close();
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:21,代码来源:HBaseTestCase.java

示例3: doGets

import org.apache.hadoop.hbase.client.HTable; //导入方法依赖的package包/类
private long doGets(int maxOps, final HTable... tables) throws Exception {
  int count = 0;
  try {
    while (count < maxOps) {
      Get get = new Get(Bytes.toBytes("row-" + count));
      for (final HTable table : tables) {
        table.get(get);
      }
      count += tables.length;
    }
  } catch (ThrottlingException e) {
    LOG.error("get failed after nRetries=" + count, e);
  }
  return count;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestQuotaThrottle.java

示例4: verifyEdit

import org.apache.hadoop.hbase.client.HTable; //导入方法依赖的package包/类
void verifyEdit(int familyNum, int putNum, HTable table) throws IOException {
  Result r = table.get(createGet(familyNum, putNum));
  byte[] family = FAMILIES[familyNum - 1];
  byte[] qf = Bytes.toBytes("q" + familyNum);
  byte[] val = Bytes.toBytes("val" + familyNum + "-" + putNum);
  assertNotNull(("Missing Put#" + putNum + " for CF# " + familyNum), r.getFamilyMap(family));
  assertNotNull(("Missing Put#" + putNum + " for CF# " + familyNum),
    r.getFamilyMap(family).get(qf));
  assertTrue(("Incorrect value for Put#" + putNum + " for CF# " + familyNum),
    Arrays.equals(r.getFamilyMap(family).get(qf), val));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:TestPerColumnFamilyFlush.java


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