Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HColumnDescriptor


  @Test
  public void testAddColumn() throws IOException {
    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    // Create a table with two families
    HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
    baseHtd.addFamily(new HColumnDescriptor(FAMILY_0));
    admin.createTable(baseHtd);
    admin.disableTable(TABLE_NAME);
    try {
      // Verify the table descriptor
      verifyTableDescriptor(TABLE_NAME, FAMILY_0);

      // Modify the table removing one family and verify the descriptor
      admin.addColumn(TABLE_NAME, new HColumnDescriptor(FAMILY_1));
      verifyTableDescriptor(TABLE_NAME, FAMILY_0, FAMILY_1);
    } finally {
      admin.deleteTable(TABLE_NAME);
    }
  }
View Full Code Here


  @Test
  public void testDeleteColumn() throws IOException {
    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    // Create a table with two families
    HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
    baseHtd.addFamily(new HColumnDescriptor(FAMILY_0));
    baseHtd.addFamily(new HColumnDescriptor(FAMILY_1));
    admin.createTable(baseHtd);
    admin.disableTable(TABLE_NAME);
    try {
      // Verify the table descriptor
      verifyTableDescriptor(TABLE_NAME, FAMILY_0, FAMILY_1);
View Full Code Here

    return TestBitSet.createBitSet(NUM_KEY_VALUES, items);
  }

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

    byte[] qualifierName2 = Bytes.toBytes("qualifer2");
    IdxIndexDescriptor indexDescriptor2
        = new IdxIndexDescriptor(qualifierName2, IdxQualifierType.INT);
    descriptor2.addIndexDescriptor(indexDescriptor2);

    HColumnDescriptor descriptor2WithoutDec = new HColumnDescriptor(descriptor2);

    Assert.assertTrue("The compare to should not have returned 0", descriptor1.compareTo(descriptor2WithoutDec) != 0);
  }
View Full Code Here

        continue;
      // we are only concerned with the first one (in case this is a cf:cq)
      cfSet.add(aColumn.split(":", 2)[0]);
    }
    for (String cf : cfSet) {
      HColumnDescriptor hcd = new HColumnDescriptor(Bytes.toBytes(cf));
      htd.addFamily(hcd);
    }
    LOG.warn(format("Creating table '%s' with '%s' columns and default descriptors.",
      tableName, cfSet));
    admin.createTable(htd);
View Full Code Here

  protected HTableDescriptor constructTableDescriptor(byte[] tableName,
    byte[]... families) {
    HTableDescriptor htd = new HTableDescriptor(tableName);
    for (byte[] family : families) {
      htd.addFamily(new HColumnDescriptor(family));
    }
    return htd;
  }
View Full Code Here

  private void init(String methodName) throws IOException {
    //Setting up a Store
    Path basedir = new Path(DIR+methodName);
    Path logdir = new Path(DIR+methodName+"/logs");
    HColumnDescriptor hcd = new HColumnDescriptor(family);
    HBaseConfiguration conf = new HBaseConfiguration();
    FileSystem fs = FileSystem.get(conf);
    Path reconstructionLog = null;
    Progressable reporter = null;
View Full Code Here

   
 
  protected void setUp() throws Exception {
    super.setUp();
    HTableDescriptor htd = new HTableDescriptor(getName());
    htd.addFamily(new HColumnDescriptor(FAMILIES[0]));
    htd.addFamily(new HColumnDescriptor(FAMILIES[1]));
    HRegionInfo info = new HRegionInfo(htd, null, null, false);
    this.region = HRegion.createHRegion(info, this.testDir, this.conf);
   
    // Insert first half
    for(byte [] ROW : ROWS_ONE) {
View Full Code Here

 
  private HTable createTable(byte [] tableName, byte [][] families)
  throws IOException {
    HTableDescriptor desc = new HTableDescriptor(tableName);
    for(byte [] family : families) {
      desc.addFamily(new HColumnDescriptor(family));
    }
    HBaseAdmin admin = new HBaseAdmin(conf);
    admin.createTable(desc);
    return new HTable(conf, tableName);
  }
View Full Code Here

  private HTable createTable(byte [] tableName, byte [][] families,
      int numVersions)
  throws IOException {
    HTableDescriptor desc = new HTableDescriptor(tableName);
    for(byte [] family : families) {
      HColumnDescriptor hcd = new HColumnDescriptor(family, numVersions,
          HColumnDescriptor.DEFAULT_COMPRESSION,
          HColumnDescriptor.DEFAULT_IN_MEMORY,
          HColumnDescriptor.DEFAULT_BLOCKCACHE,
          Integer.MAX_VALUE, HColumnDescriptor.DEFAULT_TTL, false);
      desc.addFamily(hcd);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.HColumnDescriptor

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.