Package org.apache.hadoop.hbase.index

Examples of org.apache.hadoop.hbase.index.IndexSpecification.addIndexColumn()


    Configuration conf = TEST_UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("testIndexPutWithMultipleUnitLengthSeparator");
    HRegionInfo info = new HRegionInfo(htd.getName(), "ABC".getBytes(), "BBB".getBytes(), false);
    HRegion region = HRegion.createHRegion(info, basedir, conf, htd);
    IndexSpecification spec = new IndexSpecification("index");
    spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", new SeparatorPartition("---", 6),
      ValueType.String, 10);

    byte[] value1 = "AB---CD---EF---GH---IJ---KL---MN---OP---".getBytes();
    Put p = new Put("row".getBytes());
    p.add("col".getBytes(), "ql1".getBytes(), value1);
View Full Code Here


    Configuration conf = TEST_UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("testIndexPutWithMultipleUnitLengthSeparator");
    HRegionInfo info = new HRegionInfo(htd.getName(), "ABC".getBytes(), "BBB".getBytes(), false);
    HRegion region = HRegion.createHRegion(info, basedir, conf, htd);
    IndexSpecification spec = new IndexSpecification("index");
    spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", new SeparatorPartition("---", 6),
      ValueType.String, 10);

    byte[] value1 = "AB---CD---EF---GH---IJ---K-L---MN---OP---".getBytes();
    Put p = new Put("row".getBytes());
    p.add("col".getBytes(), "ql1".getBytes(), value1);
View Full Code Here

    Configuration conf = TEST_UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("testIndexPutWithOffsetAndLength");
    HRegionInfo info = new HRegionInfo(htd.getName(), "ABC".getBytes(), "BBB".getBytes(), false);
    HRegion region = HRegion.createHRegion(info, basedir, conf, htd);
    IndexSpecification spec = new IndexSpecification("index");
    spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", new SpatialPartition(20, 2),
      ValueType.String, 18);

    byte[] value1 = "AB---CD---EF---GH---IJ---KL---MN---OP---".getBytes();
    Put p = new Put("row".getBytes());
    p.add("col".getBytes(), "ql1".getBytes(), value1);
View Full Code Here

    HTableDescriptor htd =
        new HTableDescriptor("testIndexPutWithOffsetAndLengthWhenPutIsSmallerThanOffset");
    HRegionInfo info = new HRegionInfo(htd.getName(), "ABC".getBytes(), "BBB".getBytes(), false);
    HRegion region = HRegion.createHRegion(info, basedir, conf, htd);
    IndexSpecification spec = new IndexSpecification("index");
    spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", new SpatialPartition(20, 2),
      ValueType.String, 18);

    byte[] value1 = "AB---CD---EF---GH".getBytes();
    Put p = new Put("row".getBytes());
    p.add("col".getBytes(), "ql1".getBytes(), value1);
View Full Code Here

  public void testExtentedParametersValidityFailScenarios() throws IOException {
    IndexSpecification spec = new IndexSpecification("index");

    // When separator length is zero
    try {
      spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", new SeparatorPartition("", 4),
        ValueType.String, 10);
      Assert.fail("Testcase should fail if separator length is zero.");
    } catch (IllegalArgumentException e) {
    }
View Full Code Here

    } catch (IllegalArgumentException e) {
    }

    // when the valuePosition is zero with separator
    try {
      spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", new SeparatorPartition("--", 0),
        ValueType.String, 10);
      Assert
          .fail("the testcase should fail if the valuePosition with the separator is passed as zero.");
    } catch (IllegalArgumentException e) {
    }
View Full Code Here

  public void testExtentedParametersValidityPassScenarios() throws IOException {
    IndexSpecification spec = new IndexSpecification("index");

    // When the provided arguments are correct
    try {
      spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", new SpatialPartition(4, 10),
        ValueType.String, 10);
    } catch (IllegalArgumentException e) {
      Assert.fail("the testcase should not throw exception as the arguments passed are correct.");
    }
View Full Code Here

      Assert.fail("the testcase should not throw exception as the arguments passed are correct.");
    }

    // When the provided arguments are correct
    try {
      spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", new SeparatorPartition("--", 1),
        ValueType.String, 10);
    } catch (IllegalArgumentException e) {
      Assert.fail("the testcase should not throw exception as the arguments passed are correct.");
    }
View Full Code Here

    } catch (IllegalArgumentException e) {
      Assert.fail("the testcase should not throw exception as the arguments passed are correct.");
    }

    try {
      spec.addIndexColumn(new HColumnDescriptor("col"), "ql2", ValueType.String, 10);
    } catch (IllegalArgumentException e) {
      Assert.fail("the testcase should not throw exception as the arguments passed are correct.");
    }
  }
View Full Code Here

    HTableDescriptor htd = new HTableDescriptor("testIndexPutwithPositiveIntDataTypes");
    HRegionInfo info = new HRegionInfo(htd.getName(), "ABC".getBytes(), "BBB".getBytes(), false);
    // HLog hlog = UTIL.getMiniHBaseCluster().getRegionServer(0).getWAL();
    HRegion region = HRegion.createHRegion(info, basedir, conf, htd);
    IndexSpecification spec = new IndexSpecification("index");
    spec.addIndexColumn(new HColumnDescriptor("col"), "ql1", ValueType.Int, 4);
    spec.addIndexColumn(new HColumnDescriptor("col"), "ql2", ValueType.Float, 4);

    byte[] value1 = Bytes.toBytes(1000);
    Put p = new Put("row".getBytes());
    p.add("col".getBytes(), "ql1".getBytes(), value1);
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.