Package org.apache.hadoop.hbase.index

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


    Configuration conf = TEST_UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("testPutWithOneUnitLengthSeparator");
    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("_", 4),
      ValueType.String, 10);

    byte[] value1 = "2ndFloor_solitaire_huawei_bangalore_karnataka".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("testPutWithOneUnitLengthSeparator");
    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("---", 1),
      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("testPutWithOneUnitLengthSeparatorWithoutValue");
    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("_", 4),
      ValueType.String, 10);
    byte[] value1 = "2ndFloor_solitaire_huawei__karnataka".getBytes();
    Put p = new Put("row".getBytes());
    p.add("col".getBytes(), "ql1".getBytes(), value1);
    Put indexPut = IndexUtils.prepareIndexPut(p, spec, region);
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---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

  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) {
    }

    // 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

      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

    Configuration conf = TEST_UTIL.getConfiguration();
    HTableDescriptor htd = new HTableDescriptor("testIndexPutWithSeparatorAndDataType");
    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("---", 4),
      ValueType.Int, 4);

    byte[] putValue = new byte[19];
    byte[] value1 = "AB---CD---EF---".getBytes();
    byte[] value2 = Bytes.toBytes(100000);
View Full Code Here

  @Override
  public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    PartitionType p = PartitionType.valueOf(in.readUTF());
    if (p.equals(PartitionType.SEPARATOR)) {
      valuePartition = new SeparatorPartition();
    } else if (p.equals(PartitionType.SPATIAL)) {
      valuePartition = new SpatialPartition();
    }
    if (valuePartition != null) {
      valuePartition.readFields(in);
View Full Code Here

TOP

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

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.