Package org.apache.hadoop.hbase.index

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


    ihtd.addFamily(hcd1);
    ihtd.addFamily(hcd2);
    ihtd.addFamily(hcd3);

    // Create and add indices
    IndexSpecification iSpec1 = new IndexSpecification("Index1");
    IndexSpecification iSpec2 = new IndexSpecification("Index2");
    iSpec1.addIndexColumn(hcd1, "ql1", ValueType.String, 10);
    iSpec2.addIndexColumn(hcd2, "ql1", ValueType.String, 10);
    iSpec2.addIndexColumn(hcd3, "ql1", ValueType.String, 10);
    ihtd.addIndex(iSpec1);
    ihtd.addIndex(iSpec2);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);
View Full Code Here


    ihtd.addFamily(hcd2);
    ihtd.addFamily(hcd3);
    ihtd.addFamily(hcd4);

    // Create and add indices
    IndexSpecification iSpec2 = new IndexSpecification("Index2");
    iSpec2.addIndexColumn(hcd2, "ql1", ValueType.String, 10);
    iSpec2.addIndexColumn(hcd3, "ql1", ValueType.String, 10);
    iSpec2.addIndexColumn(hcd4, "ql1", ValueType.String, 10);
    ihtd.addIndex(iSpec2);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);

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

    ihtd.addFamily(hcd1);
    ihtd.addFamily(hcd2);
    ihtd.addFamily(hcd3);

    // Create and add indices
    IndexSpecification iSpec1 = new IndexSpecification("Index1");
    IndexSpecification iSpec2 = new IndexSpecification("Index2");
    iSpec1.addIndexColumn(hcd1, "ql1", ValueType.String, 10);
    iSpec2.addIndexColumn(hcd3, "ql1", ValueType.String, 10);
    ihtd.addIndex(iSpec1);
    ihtd.addIndex(iSpec2);
    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);
View Full Code Here

    HColumnDescriptor hcd1 = new HColumnDescriptor("col1");

    ihtd.addFamily(hcd1);

    // Create and add indices
    IndexSpecification iSpec1 = new IndexSpecification("Index1");

    iSpec1.addIndexColumn(hcd1, "ql1", ValueType.String, 10);

    ihtd.addIndex(iSpec1);

    admin.createTable(ihtd);
    ZKAssign.blockUntilNoRIT(zkw);
View Full Code Here

    Configuration conf = UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("TestIndexPut");
    HRegionInfo info = new HRegionInfo(htd.getName(), "A".getBytes(), "B".getBytes(), false);
    HLog hlog = UTIL.getMiniHBaseCluster().getRegionServer(0).getWAL();
    HRegion region = new HRegion(basedir, hlog, fs, conf, info, htd, null);
    IndexSpecification spec = new IndexSpecification("testSpec");
    spec.addIndexColumn(new HColumnDescriptor("cf1"), "ql1", ValueType.String, 10);
    spec.addIndexColumn(new HColumnDescriptor("cf2"), "ql1", ValueType.String, 10);

    // Scenario where both the indexed cols are there in the put
    byte[] rowKey = "Arow1".getBytes();
    Put p = new Put(rowKey);
    long time = 1234567;
View Full Code Here

    Configuration conf = UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("TestIndexPut");
    HRegionInfo info = new HRegionInfo(htd.getName(), "A".getBytes(), "B".getBytes(), false);
    HLog hlog = UTIL.getMiniHBaseCluster().getRegionServer(0).getWAL();
    HRegion region = new HRegion(basedir, hlog, fs, conf, info, htd, null);
    IndexSpecification spec = new IndexSpecification("testSpec");
    spec.addIndexColumn(new HColumnDescriptor("cf1"), "ql1", ValueType.String, 10);
    spec.addIndexColumn(new HColumnDescriptor("cf2"), "ql1", ValueType.String, 10);

    byte[] rowKey = "Arow1".getBytes();
    Put p = new Put(rowKey);
    long time = 1234567;
    p.add("cf1".getBytes(), "ql1".getBytes(), time, "testvalue1".getBytes());
View Full Code Here

    Configuration conf = UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("TestIndexPut");
    HRegionInfo info = new HRegionInfo(htd.getName(), "A".getBytes(), "B".getBytes(), false);
    HLog hlog = UTIL.getMiniHBaseCluster().getRegionServer(0).getWAL();
    HRegion region = new HRegion(basedir, hlog, fs, conf, info, htd, null);
    IndexSpecification spec = new IndexSpecification("testSpec");
    spec.addIndexColumn(new HColumnDescriptor("cf1"), "ql1", ValueType.String, 10);
    spec.addIndexColumn(new HColumnDescriptor("cf2"), "ql1", ValueType.String, 10);

    // assert IOException when value length goes beyond the limit.
    byte[] rowKey = "Arow1".getBytes();
    Put p = new Put(rowKey);
    long time = 1234567;
View Full Code Here

    Configuration conf = UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("TestIndexPut");
    HRegionInfo info = new HRegionInfo(htd.getName(), "A".getBytes(), "B".getBytes(), false);
    HLog hlog = UTIL.getMiniHBaseCluster().getRegionServer(0).getWAL();
    HRegion region = new HRegion(basedir, hlog, fs, conf, info, htd, null);
    IndexSpecification spec = new IndexSpecification("index");
    spec.addIndexColumn(new HColumnDescriptor("cf1"), "ql1", ValueType.String, 10);
    spec.addIndexColumn(new HColumnDescriptor("cf2"), "ql1", ValueType.String, 10);

    // scenario where same indexName but diff colvalues can disturb the order if
    // used without pad
    byte[] rowKey = "Arow1".getBytes();
    Put p1 = new Put(rowKey);
    long time = 1234567;
    p1.add("cf1".getBytes(), "ql1".getBytes(), time, "testcase".getBytes());
    p1.add("cf2".getBytes(), "ql1".getBytes(), time, "value".getBytes());
    Put indexPut1 = IndexUtils.prepareIndexPut(p1, spec, region);
    Put p2 = new Put(rowKey);
    p2.add("cf1".getBytes(), "ql1".getBytes(), time, "test".getBytes());
    p2.add("cf2".getBytes(), "ql1".getBytes(), time, "value".getBytes());
    Put indexPut2 = IndexUtils.prepareIndexPut(p2, spec, region);
    // (spaces just for easier reading...not present in actual)
    // Index Row key For p1 = "A index testcase value Arow1"
    // Index Row key For p2 = "A index test value Arow1"
    // NOW acc. to the lexographical ordering p2 should come second but we need
    // it to come 1st datz where pad is needed.
    byte[] rowKey1 = indexPut1.getRow();
    byte[] rowKey2 = indexPut2.getRow();

    int result = Bytes.compareTo(rowKey1, rowKey2);
    Assert.assertTrue(result > 0);

    // scenario where the index names are diff and padding is needed.
    IndexSpecification spec1 = new IndexSpecification("ind");
    spec1.addIndexColumn(new HColumnDescriptor("cf3"), "ql1", ValueType.String, 10);
    p1 = new Put(rowKey);
    p1.add("cf3".getBytes(), "ql1".getBytes(), time, "testcase".getBytes());
    indexPut1 = IndexUtils.prepareIndexPut(p1, spec1, region);
    // (spaces just for easier reading...not present in actual)
    // Index Row key For p1 = "A ind testcase value Arow1"
View Full Code Here

    Configuration conf = UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("TestIndexPut");
    HRegionInfo info = new HRegionInfo(htd.getName(), "ABC".getBytes(), "BBB".getBytes(), false);
    HLog hlog = UTIL.getMiniHBaseCluster().getRegionServer(0).getWAL();
    HRegion region = new HRegion(basedir, hlog, fs, conf, info, htd, null);
    IndexSpecification spec = new IndexSpecification("index");
    spec.addIndexColumn(new HColumnDescriptor("cf1"), "ql1", ValueType.String, 10);
    spec.addIndexColumn(new HColumnDescriptor("cf2"), "ql1", ValueType.String, 10);

    byte[] rowKey = "Arow1".getBytes();
    Put p1 = new Put(rowKey);
    long time = 1234567;
    p1.add("cf1".getBytes(), "ql1".getBytes(), time, "testcase".getBytes());
View Full Code Here

    conf.setInt("hbase.regionserver.lease.period", 90000000);
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    String userTableName = "testIndexRegionSplit";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    IndexSpecification iSpec = new IndexSpecification("ScanIndexf");
    iSpec.addIndexColumn(new HColumnDescriptor("col"), "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

Related Classes of org.apache.hadoop.hbase.index.IndexSpecification

Copyright © 2018 www.massapicom. 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.