Examples of IndexSpecification


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

  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

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

  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

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

    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

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

  }

  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

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

    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

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

    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

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

    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

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

    outerFL.addFilter(innerFL);
    scan.setFilter(outerFL);

    ScanFilterEvaluator evaluator = new ScanFilterEvaluator();
    List<IndexSpecification> indices = new ArrayList<IndexSpecification>();
    IndexSpecification is1 = new IndexSpecification(index1);
    HColumnDescriptor colDesc = new HColumnDescriptor(FAMILY1);
    is1.addIndexColumn(colDesc, COL2, ValueType.Int, 4);
    is1.addIndexColumn(colDesc, COL3, ValueType.Float, 4);
    indices.add(is1);
    IndexSpecification is2 = new IndexSpecification(index2);
    is2.addIndexColumn(colDesc, COL1, ValueType.String, 15);
    indices.add(is2);
    IndexSpecification is3 = new IndexSpecification(index3);
    colDesc = new HColumnDescriptor(FAMILY2);
    is3.addIndexColumn(colDesc, COL1, ValueType.Double, 8);
    indices.add(is3);

    HRegion region =
        initHRegion(tableName.getBytes(), null, null, "testMultiIndexExpression",
          TEST_UTIL.getConfiguration(), FAMILY1);
View Full Code Here

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

    Scan scan = new Scan();
    scan.setAttribute(Constants.INDEX_EXPRESSION, IndexUtils.toBytes(exp));
    byte[] value1 = Bytes.toBytes("asdf");
    scan.setFilter(new SingleColumnValueFilter(FAMILY1, QUALIFIER1, CompareOp.EQUAL, value1));
    List<IndexSpecification> indices = new ArrayList<IndexSpecification>();
    IndexSpecification is1 = new IndexSpecification("idx1");
    HColumnDescriptor colDesc = new HColumnDescriptor(FAMILY1);
    is1.addIndexColumn(colDesc, COL1, ValueType.String, 15);
    indices.add(is1);
    ScanFilterEvaluator evaluator = new ScanFilterEvaluator();
    HRegion region =
        initHRegion(tableName.getBytes(), null, null, "testNoIndexExpression",
          TEST_UTIL.getConfiguration(), FAMILY1);
View Full Code Here

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

    conf.setInt("hbase.regionserver.lease.period", 900000000);
    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
    String userTableName = "testPutOnIndexedScanColumnWithOnePut";
    IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
    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);
    ZKAssign.blockUntilNoRIT(zkw);
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.