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


Java HTestConst.DEFAULT_TABLE属性代码示例

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


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

示例1: testProcessBasedCluster

public void testProcessBasedCluster() throws Exception {
  ProcessBasedLocalHBaseCluster cluster = new ProcessBasedLocalHBaseCluster(
      TEST_UTIL.getConfiguration(), 2, 3);
  cluster.startMiniDFS();
  cluster.startHBase();
  try {
    TEST_UTIL.createRandomTable(HTestConst.DEFAULT_TABLE_STR,
        HTestConst.DEFAULT_CF_STR_SET,
        HColumnDescriptor.DEFAULT_VERSIONS, COLS_PER_ROW, FLUSHES, NUM_REGIONS,
        ROWS_PER_FLUSH);
    Table table = new HTable(TEST_UTIL.getConfiguration(), HTestConst.DEFAULT_TABLE);
    ResultScanner scanner = table.getScanner(HTestConst.DEFAULT_CF_BYTES);
    Result result;
    int rows = 0;
    int cols = 0;
    while ((result = scanner.next()) != null) {
      ++rows;
      cols += result.getFamilyMap(HTestConst.DEFAULT_CF_BYTES).size();
    }
    LOG.info("Read " + rows + " rows, " + cols + " columns");
    scanner.close();
    table.close();

    // These numbers are deterministic, seeded by table name.
    assertEquals(19, rows);
    assertEquals(35, cols);
  } catch (Exception ex) {
    LOG.error(ex);
    throw ex;
  } finally {
    cluster.shutdown();
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:33,代码来源:TestProcessBasedCluster.java

示例2: testScanLimitAndOffset

/**
 * Test from client side for scan with maxResultPerCF set
 *
 * @throws Exception
 */
@Test
public void testScanLimitAndOffset() throws Exception {
  //byte [] TABLE = HTestConst.DEFAULT_TABLE_BYTES;
  byte [][] ROWS = HTestConst.makeNAscii(HTestConst.DEFAULT_ROW_BYTES, 2);
  byte [][] FAMILIES = HTestConst.makeNAscii(HTestConst.DEFAULT_CF_BYTES, 3);
  byte [][] QUALIFIERS = HTestConst.makeNAscii(HTestConst.DEFAULT_QUALIFIER_BYTES, 10);

  HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(HTestConst.DEFAULT_TABLE_BYTES));
  HRegionInfo info = new HRegionInfo(HTestConst.DEFAULT_TABLE, null, null, false);
  for (byte[] family : FAMILIES) {
    HColumnDescriptor hcd = new HColumnDescriptor(family);
    htd.addFamily(hcd);
  }
  HRegion region =
      HRegion.createHRegion(info, TEST_UTIL.getDataTestDir(), TEST_UTIL.getConfiguration(), htd);
  try {
    Put put;
    Scan scan;
    Result result;
    boolean toLog = true;

    List<Cell> kvListExp = new ArrayList<Cell>();

    int storeOffset = 1;
    int storeLimit = 3;
    for (int r = 0; r < ROWS.length; r++) {
      put = new Put(ROWS[r]);
      for (int c = 0; c < FAMILIES.length; c++) {
        for (int q = 0; q < QUALIFIERS.length; q++) {
          KeyValue kv = new KeyValue(ROWS[r], FAMILIES[c], QUALIFIERS[q], 1,
              HTestConst.DEFAULT_VALUE_BYTES);
          put.add(kv);
          if (storeOffset <= q && q < storeOffset + storeLimit) {
            kvListExp.add(kv);
          }
        }
      }
      region.put(put);
    }

    scan = new Scan();
    scan.setRowOffsetPerColumnFamily(storeOffset);
    scan.setMaxResultsPerColumnFamily(storeLimit);
    RegionScanner scanner = region.getScanner(scan);
    List<Cell> kvListScan = new ArrayList<Cell>();
    List<Cell> results = new ArrayList<Cell>();
    while (scanner.next(results) || !results.isEmpty()) {
      kvListScan.addAll(results);
      results.clear();
    }
    result = Result.create(kvListScan);
    TestScannersFromClientSide.verifyResult(result, kvListExp, toLog,
        "Testing scan with storeOffset and storeLimit");
  } finally {
    region.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:62,代码来源:TestIntraRowPagination.java

示例3: testScanLimitAndOffset

/**
 * Test from client side for scan with maxResultPerCF set
 *
 * @throws Exception
 */
@Test
public void testScanLimitAndOffset() throws Exception {
  //byte [] TABLE = HTestConst.DEFAULT_TABLE_BYTES;
  byte [][] ROWS = HTestConst.makeNAscii(HTestConst.DEFAULT_ROW_BYTES, 2);
  byte [][] FAMILIES = HTestConst.makeNAscii(HTestConst.DEFAULT_CF_BYTES, 3);
  byte [][] QUALIFIERS = HTestConst.makeNAscii(HTestConst.DEFAULT_QUALIFIER_BYTES, 10);

  HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(HTestConst.DEFAULT_TABLE_BYTES));
  HRegionInfo info = new HRegionInfo(HTestConst.DEFAULT_TABLE, null, null, false);
  for (byte[] family : FAMILIES) {
    HColumnDescriptor hcd = new HColumnDescriptor(family);
    htd.addFamily(hcd);
  }
  HRegion region = HBaseTestingUtility.createRegionAndWAL(info, TEST_UTIL.getDataTestDir(),
      TEST_UTIL.getConfiguration(), htd);
  try {
    Put put;
    Scan scan;
    Result result;
    boolean toLog = true;

    List<Cell> kvListExp = new ArrayList<>();

    int storeOffset = 1;
    int storeLimit = 3;
    for (int r = 0; r < ROWS.length; r++) {
      put = new Put(ROWS[r]);
      for (int c = 0; c < FAMILIES.length; c++) {
        for (int q = 0; q < QUALIFIERS.length; q++) {
          KeyValue kv = new KeyValue(ROWS[r], FAMILIES[c], QUALIFIERS[q], 1,
              HTestConst.DEFAULT_VALUE_BYTES);
          put.add(kv);
          if (storeOffset <= q && q < storeOffset + storeLimit) {
            kvListExp.add(kv);
          }
        }
      }
      region.put(put);
    }

    scan = new Scan();
    scan.setRowOffsetPerColumnFamily(storeOffset);
    scan.setMaxResultsPerColumnFamily(storeLimit);
    RegionScanner scanner = region.getScanner(scan);
    List<Cell> kvListScan = new ArrayList<>();
    List<Cell> results = new ArrayList<>();
    while (scanner.next(results) || !results.isEmpty()) {
      kvListScan.addAll(results);
      results.clear();
    }
    result = Result.create(kvListScan);
    TestScannersFromClientSide.verifyResult(result, kvListExp, toLog,
        "Testing scan with storeOffset and storeLimit");
  } finally {
    HBaseTestingUtility.closeRegionAndWAL(region);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:62,代码来源:TestIntraRowPagination.java


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