Package org.apache.hadoop.hbase.index

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


  @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


  @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));
View Full Code Here

    IndexManager im = IndexManager.getInstance();
    assertNotNull("Index Manager should not be null.", im);

    List<IndexSpecification> indexList = new ArrayList<IndexSpecification>(1);
    IndexSpecification iSpec = new IndexSpecification("index_name");

    iSpec.addIndexColumn(new HColumnDescriptor("cf"), "cq", null, 10);
    indexList.add(iSpec);
    im.addIndexForTable("index_name", indexList);
    indexList = im.getIndicesForTable("index_name");
    assertEquals("Index name should be equal with actual value.", "index_name", indexList.get(0)
        .getName());
View Full Code Here

  public void testShouldNotThrowNPEIfValueTypeIsNull() throws Exception {
    IndexManager im = IndexManager.getInstance();
    assertNotNull("Index Manager should not be null.", im);

    List<IndexSpecification> indexList = new ArrayList<IndexSpecification>(1);
    IndexSpecification iSpec = new IndexSpecification("index_name");

    iSpec.addIndexColumn(new HColumnDescriptor("cf"), "cq", null, 5);
    indexList.add(iSpec);
    im.addIndexForTable("index_name", indexList);
    indexList = im.getIndicesForTable("index_name");

    Set<ColumnQualifier> indexColumns = indexList.get(0).getIndexColumns();
View Full Code Here

  public void testAddIndexForTableWhenStringAndValLengthIsZero() throws Exception {
    IndexManager im = IndexManager.getInstance();
    assertNotNull("Index Manager should not be null.", im);

    List<IndexSpecification> indexList = new ArrayList<IndexSpecification>(1);
    IndexSpecification iSpec = new IndexSpecification("index_name");

    iSpec.addIndexColumn(new HColumnDescriptor("cf"), "cq", null, 0);
    indexList.add(iSpec);
    im.addIndexForTable("index_name", indexList);
    indexList = im.getIndicesForTable("index_name");
    assertEquals("the total value length should be 2", 2, indexList.get(0).getTotalValueLength());
  }
View Full Code Here

    IndexManager im = IndexManager.getInstance();
    assertNotNull("Index Manager should not be null.", im);

    List<IndexSpecification> indexList = new ArrayList<IndexSpecification>(1);
    IndexSpecification iSpec = new IndexSpecification("index_name");

    iSpec.addIndexColumn(new HColumnDescriptor("cf"), "cq", null, 10);
    indexList.add(iSpec);
    im.removeIndices("index_name");
    indexList = im.getIndicesForTable("index_name");
    assertNull("Index specification List should be null.", indexList);
View Full Code Here

  }

  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

    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);
View Full Code Here

    scan.setAttribute(Constants.INDEX_EXPRESSION, IndexUtils.toBytes(singleIndexExpression));
    Filter filter = new SingleColumnValueFilter(FAMILY1, QUALIFIER1, CompareOp.EQUAL, value);
    scan.setFilter(filter);
    ScanFilterEvaluator evaluator = new ScanFilterEvaluator();
    List<IndexSpecification> indices = new ArrayList<IndexSpecification>();
    IndexSpecification index = new IndexSpecification(indexName);
    HColumnDescriptor colDesc = new HColumnDescriptor(FAMILY1);
    index.addIndexColumn(colDesc, COL1, ValueType.String, 10);
    indices.add(index);
    HRegion region =
        initHRegion(tableName.getBytes(), null, null,
          "testSingleIndexExpressionWithOneEqualsExpression", TEST_UTIL.getConfiguration(), FAMILY1);
    IndexRegionScanner scanner = evaluator.evaluate(scan, indices, new byte[0], region, tableName);
View Full Code Here

    fl.addFilter(filter);
    scan.setFilter(fl);

    ScanFilterEvaluator evaluator = new ScanFilterEvaluator();
    List<IndexSpecification> indices = new ArrayList<IndexSpecification>();
    IndexSpecification index = new IndexSpecification(indexName);
    HColumnDescriptor colDesc = new HColumnDescriptor(FAMILY1);
    index.addIndexColumn(colDesc, COL1, ValueType.String, 10);
    index.addIndexColumn(colDesc, COL2, ValueType.Int, 4);
    index.addIndexColumn(colDesc, COL3, ValueType.Float, 4);
    indices.add(index);

    HRegion region =
        initHRegion(tableName.getBytes(), null, null,
          "testSingleIndexExpressionWithMoreEqualsExpsAndOneRangeExp",
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.