當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。