Examples of IndexedHTableDescriptor


Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

  }

  @Test(timeout = 180000)
  public void testShouldAbleReturnTrueForIndexedTable() throws Exception {
    tableName = "testShouldAbleReturnTrueForIndexedTable";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(tableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("ScanIndexf");
    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addFamily(hcd);
    ihtd.addIndex(iSpec);
    admin.createTable(ihtd);
    Assert.assertTrue(IndexMapReduceUtil.isIndexedTable(tableName, conf));
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

  }

  @Test(timeout = 180000)
  public void testShouldFormIndexPutsAndIndexDeletes() throws Exception {
    tableName = "testShouldFormIndexPutsAndIndexDeletes";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(tableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("ScanIndexf");
    iSpec.addIndexColumn(hcd, "q1", ValueType.String, 10);
    iSpec.addIndexColumn(hcd, "q2", ValueType.String, 10);
    ihtd.addFamily(hcd);
    ihtd.addIndex(iSpec);
    admin.getConfiguration().set(TableInputFormat.INPUT_TABLE, tableName);
    admin.createTable(ihtd);
    HTable mainTable = new HTable(conf, Bytes.toBytes(tableName));
    Put put = new Put(Bytes.toBytes("r1"));
    put.add(hcd.getName(), Bytes.toBytes("q1"), Bytes.toBytes("v1"));
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

  @Test(timeout = 180000)
  public void testWithFastDiffEncoding() throws Exception {
    HBaseAdmin admin = UTIL.getHBaseAdmin();
    String tableName = "testWithFastDiffEncoding";
    String idxTableName = "testWithFastDiffEncoding_idx";
    IndexedHTableDescriptor htd = createIndexedHTableDescriptor(tableName, CF1, "idx1", CF1, COL1);
    admin.createTable(htd);
    HTable ht = new HTable(UTIL.getConfiguration(), tableName);
    HTable hti = new HTable(UTIL.getConfiguration(), idxTableName);
    Put put = new Put("a".getBytes());
    put.add(CF1.getBytes(), COL1.getBytes(), "1".getBytes());
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

    assertEquals(3, count);
  }

  private IndexedHTableDescriptor createIndexedHTableDescriptor(String tableName,
      String columnFamily, String indexName, String indexColumnFamily, String indexColumnQualifier) {
    IndexedHTableDescriptor htd = new IndexedHTableDescriptor(tableName);
    IndexSpecification iSpec = new IndexSpecification(indexName);
    HColumnDescriptor hcd = new HColumnDescriptor(columnFamily);
    iSpec.addIndexColumn(hcd, indexColumnQualifier, ValueType.String, 10);
    htd.addFamily(hcd);
    htd.addIndex(iSpec);
    return htd;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

  private List<KeyValue> genSomeKeys(String userTableName) throws Exception {
    List<KeyValue> ret = new ArrayList<KeyValue>(4);
    HBaseAdmin admin = UTIL.getHBaseAdmin();
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd1 = new HColumnDescriptor("column1");
    HColumnDescriptor hcd2 = new HColumnDescriptor("column2");
    IndexSpecification iSpec1 = new IndexSpecification("Index");
    iSpec1.addIndexColumn(hcd1, "q", ValueType.String, 10);
    iSpec1.addIndexColumn(hcd2, "q", ValueType.String, 10);
    ihtd.addFamily(hcd1);
    ihtd.addFamily(hcd2);
    ihtd.addIndex(iSpec1);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);
    ByteArrayBuilder indexColVal = ByteArrayBuilder.allocate(4);
    indexColVal.put(Bytes.toBytes((short) 3));
    indexColVal.put(Bytes.toBytes((short) 32));
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

    HBaseAdmin admin = UTIL.getHBaseAdmin();
    Configuration conf = UTIL.getConfiguration();
    conf.setInt("hbase.regionserver.lease.period", 900000000);
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    String userTableName = "testPutOnIndexedScanColumnWithOnePut";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("ScanIndexf");
    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addFamily(hcd);
    ihtd.addIndex(iSpec);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);

    HTable table = new HTable(conf, userTableName);
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

    HBaseAdmin admin = UTIL.getHBaseAdmin();
    Configuration conf = UTIL.getConfiguration();
    conf.setInt("hbase.regionserver.lease.period", 900000000);
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    String userTableName = "testScanOnIndexedScanSplitColumnWithOnePut";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("ScanIndexf");
    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addFamily(hcd);
    ihtd.addIndex(iSpec);
    byte[][] split =
        new byte[][] { "row1".getBytes(), "row21".getBytes(), "row41".getBytes(),
            "row61".getBytes(), "row81".getBytes(), "row101".getBytes(), "row121".getBytes(),
            "row141".getBytes(), };
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

    HBaseAdmin admin = UTIL.getHBaseAdmin();
    Configuration conf = UTIL.getConfiguration();
    conf.setInt("hbase.regionserver.lease.period", 900000000);
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    String userTableName = "testScanOnIndexedSplitStRegExmptyColumnWithOnePut";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("ScanIndexf");
    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addFamily(hcd);
    ihtd.addIndex(iSpec);

    byte[][] split = new byte[][] { "A".getBytes(), "B".getBytes(), "C".getBytes() };

    // create table with splits this will create 9 regions
    admin.createTable(ihtd, split);
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

    HBaseAdmin admin = UTIL.getHBaseAdmin();
    Configuration conf = UTIL.getConfiguration();
    conf.setInt("hbase.regionserver.lease.period", 900000000);
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    String userTableName = "testScanOnIndexedSplitSpacedColumnWithOnePut";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("ScanIndexf");
    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addFamily(hcd);
    ihtd.addIndex(iSpec);

    byte[][] split =
        new byte[][] { " row1".getBytes(), "row21".getBytes(), "row41".getBytes(),
            "row61".getBytes(), "row81".getBytes(), "row101 ".getBytes(), "row121".getBytes(),
            "row141".getBytes(), };
View Full Code Here

Examples of org.apache.hadoop.hbase.index.IndexedHTableDescriptor

    HBaseAdmin admin = UTIL.getHBaseAdmin();
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    Configuration conf = UTIL.getConfiguration();
    conf.setInt("hbase.regionserver.lease.period", 900000000);
    String userTableName = "testPutOnIndexedScanColumnWith2Puts";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("ScanIndexq");
    iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
    ihtd.addFamily(hcd);
    ihtd.addIndex(iSpec);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);

    HTable table = new HTable(conf, userTableName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.