Package org.apache.hadoop.hbase.client.idx

Examples of org.apache.hadoop.hbase.client.idx.IdxIndexDescriptor


    HTableDescriptor desc = new HTableDescriptor("testConcurrentReadWrite");
    byte[] family = Bytes.toBytes("concurrentRW");
    byte[] qualifier = Bytes.toBytes("strings");
    IdxColumnDescriptor descriptor = new IdxColumnDescriptor(family);
    descriptor.addIndexDescriptor(new IdxIndexDescriptor(qualifier,
      IdxQualifierType.CHAR_ARRAY));
    desc.addFamily(descriptor);
    HBaseAdmin admin = new HBaseAdmin(conf);
    admin.createTable(desc);
    HTable table = new HTable(conf, desc.getName());
View Full Code Here


     * Test long type.
     */
    value = Bytes.toBytes(98L);
    id = 35;
    bldr = new CompleteIndexBuilder(columnDescriptor,
      new IdxIndexDescriptor(QUALIFIER, IdxQualifierType.LONG));
    bldr.addKeyValue(new KeyValue(ROW, FAMILY, QUALIFIER, value), id);
    Assert.assertTrue(
      bldr.finalizeIndex(NUM_KEY_VALUES).lookup(value).contains(id));

    /**
     * Test double type
     */
    value = Bytes.toBytes(9.8D);
    id = 899;
    bldr = new CompleteIndexBuilder(columnDescriptor,
      new IdxIndexDescriptor(QUALIFIER, IdxQualifierType.DOUBLE));
    bldr.addKeyValue(new KeyValue(ROW, FAMILY, QUALIFIER, value), id);
    Assert.assertTrue(
      bldr.finalizeIndex(NUM_KEY_VALUES).lookup(value).contains(id));

    /**
     * Test the byte array type
     */
    value = Bytes.toBytes(this.getClass().getName());
    id = 1016;
    bldr = new CompleteIndexBuilder(columnDescriptor,
      new IdxIndexDescriptor(QUALIFIER, IdxQualifierType.BYTE_ARRAY));
    bldr.addKeyValue(new KeyValue(ROW, FAMILY, QUALIFIER, value), id);
    Assert.assertTrue(
      bldr.finalizeIndex(NUM_KEY_VALUES).lookup(value).contains(id));

  }
View Full Code Here

  private static CompleteIndex fillIndex(long[] values, int[] ids) {
    Assert.assertEquals(values.length, ids.length);
    HColumnDescriptor columnDescriptor = new HColumnDescriptor(FAMILY);
    CompleteIndexBuilder completeIndex =
      new CompleteIndexBuilder(columnDescriptor,
        new IdxIndexDescriptor(QUALIFIER, IdxQualifierType.LONG));
    for (int i = 0; i < values.length; i++) {
      completeIndex.addKeyValue(new KeyValue(Bytes.toBytes(ids[i]), FAMILY,
        QUALIFIER, Bytes.toBytes(values[i])), ids[i]);
    }
    return (CompleteIndex) completeIndex.finalizeIndex(NUM_KEY_VALUES);
View Full Code Here

   *
   * @throws java.io.IOException in case of an IO error
   */
  public void testIdxRegionPerformance() throws IOException {
    IdxColumnDescriptor family1 = new IdxColumnDescriptor(FAMILY_1_NAME);
    family1.addIndexDescriptor(new IdxIndexDescriptor(INT_QUAL_NAME,
      IdxQualifierType.INT));
    family1.addIndexDescriptor(new IdxIndexDescriptor(BYTES_QUAL_NAME,
      IdxQualifierType.BYTE_ARRAY));

    IdxColumnDescriptor family2 = new IdxColumnDescriptor(FAMILY_2_NAME);
    family2.addIndexDescriptor(new IdxIndexDescriptor(CHARS_QUAL_NAME,
      IdxQualifierType.CHAR_ARRAY));

    HTableDescriptor htableDescriptor
      = new HTableDescriptor("testIdxRegionPerformance");
    htableDescriptor.addFamily(family1);
View Full Code Here

   * @throws IOException exception
   */
  public void testIndexedScanWithStartRow() throws Exception {
    byte[] tableName = Bytes.toBytes("testIndexedScanWithStartRow");
    byte[] family = Bytes.toBytes("family");
    IdxIndexDescriptor indexDescriptor
      = new IdxIndexDescriptor(qualLong, IdxQualifierType.LONG);

    // Setting up region
    String method = "testIndexedScanWithStartRow";
    initIdxRegion(tableName, method, new HBaseConfiguration(),
      Pair.of(family, new IdxIndexDescriptor[]{indexDescriptor}));
View Full Code Here

   * @throws IOException exception
   */
  public void testIndexedScanWithOneRow() throws Exception {
    byte[] tableName = Bytes.toBytes("testIndexedScanWithOneRow");
    byte[] family = Bytes.toBytes("family");
    IdxIndexDescriptor indexDescriptor
      = new IdxIndexDescriptor(qualLong, IdxQualifierType.LONG);
    byte[] row1 = Bytes.toBytes("row1");

    //Setting up region
    String method = "testIndexedScanWithOneRow";
    initIdxRegion(tableName, method, new HBaseConfiguration(),
View Full Code Here

  }

  public void testIndexedScanWithOneIndexAndOneColumn() throws Exception {
    byte[] tableName = Bytes.toBytes("testIndexedScanWithOneIndexAndOneColumn");
    byte[] family = Bytes.toBytes("family");
    IdxIndexDescriptor indexDescriptor = new IdxIndexDescriptor(qualLong,
      IdxQualifierType.LONG);
    int numRows = 10000;

    Random random = new Random(1431974L)// pseudo random order of row insertions
View Full Code Here


  public void testIndexedScanWithThreeColumns() throws Exception {
    byte[] tableName = Bytes.toBytes("testIndexedScanWithThreeColumns");
    byte[] family = Bytes.toBytes("family");
    IdxIndexDescriptor indexDescriptor1 = new IdxIndexDescriptor(qualLong, IdxQualifierType.LONG);
    IdxIndexDescriptor indexDescriptor2 = new IdxIndexDescriptor(qualDouble, IdxQualifierType.DOUBLE);
    IdxIndexDescriptor indexDescriptor3 = new IdxIndexDescriptor(qualBytes, IdxQualifierType.BYTE_ARRAY);
    int numRows = 10000;

    Random random = new Random(24122008L)// pseudo random order of row insertions

    //Setting up region
View Full Code Here

   */
  public void testIndexedScanWithTwoFamilies() throws Exception {
    byte[] tableName = Bytes.toBytes("testIndexedScanWithTwoFamilies");
    byte[] family1 = Bytes.toBytes("family1");
    byte[] family2 = Bytes.toBytes("family2");
    IdxIndexDescriptor indexDescriptor1 = new IdxIndexDescriptor(qualLong, IdxQualifierType.LONG);
    IdxIndexDescriptor indexDescriptor2 = new IdxIndexDescriptor(qualDouble, IdxQualifierType.DOUBLE);
    IdxIndexDescriptor indexDescriptor3 = new IdxIndexDescriptor(qualBytes, IdxQualifierType.BYTE_ARRAY);

    String method = "testIndexedScanWithTwoFamilies";
    initIdxRegion(tableName, method, new HBaseConfiguration(), Pair.of(family1,
      new IdxIndexDescriptor[]{indexDescriptor1, indexDescriptor2}),
      Pair.of(family2, new IdxIndexDescriptor[]{indexDescriptor3}));
View Full Code Here


  public void testIndexedScanWithMultipleVersions() throws Exception {
    byte[] tableName = Bytes.toBytes("testIndexedScanWithMultipleVersions");
    byte[] family = Bytes.toBytes("family");
    IdxIndexDescriptor indexDescriptor1 = new IdxIndexDescriptor(qualLong, IdxQualifierType.LONG);
    IdxIndexDescriptor indexDescriptor2 = new IdxIndexDescriptor(qualDouble, IdxQualifierType.DOUBLE);
    int numRows = 10000;

    Random random = new Random(27101973L)// pseudo random order of row insertions

    //Setting up region
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.client.idx.IdxIndexDescriptor

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.