Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HColumnDescriptor


    assertEquals(100, rows);
  }
 
  private HTable createTable(byte[] tableName) throws IOException {
    HTableDescriptor htd = new HTableDescriptor(tableName);
    HColumnDescriptor hcd = new HColumnDescriptor(FAMILY1);
    hcd.setMaxVersions(10);// Just setting 10 as I am not testing with more than 10 versions here
    htd.addFamily(hcd);
    TEST_UTIL.getHBaseAdmin().createTable(htd, Bytes.toBytes(0), Bytes.toBytes(120), 5);
    HTable ht = new HTable(TEST_UTIL.getConfiguration(), tableName);
    return ht;
  }
View Full Code Here


  }

  private static HTableDescriptor createHTableDescriptor(final int numFamilies) {
    HTableDescriptor htd = new HTableDescriptor(TABLE_NAME);
    for (int i = 0; i < numFamilies; ++i) {
      HColumnDescriptor colDef = new HColumnDescriptor(FAMILY_PREFIX + i);
      htd.addFamily(colDef);
    }
    return htd;
  }
View Full Code Here

        }

        HBaseAdmin admin = _dataContext.getHBaseAdmin();
        System.out.println("Creating table");
        final HTableDescriptor tableDescriptor = new HTableDescriptor(EXAMPLE_TABLE_NAME.getBytes());
        tableDescriptor.addFamily(new HColumnDescriptor("foo".getBytes()));
        tableDescriptor.addFamily(new HColumnDescriptor("bar".getBytes()));
        admin.createTable(tableDescriptor);
        System.out.println("Created table");
    }
View Full Code Here

      final int total = 20;
      for (int i = 0; i < total; i++) {
        WALEdit kvs = new WALEdit();
        kvs.add(new KeyValue(Bytes.toBytes(i), tableName, tableName));
        HTableDescriptor htd = new HTableDescriptor(tableName);
        htd.addFamily(new HColumnDescriptor("column"));
        log.append(regioninfo, tableName, kvs, System.currentTimeMillis(), htd);
      }
      // Send the data to HDFS datanodes and close the HDFS writer
      log.sync();
      log.cleanupCurrentWriter(log.getFilenum());
View Full Code Here

                // What about timestamp?

                final HColumnDescriptor[] columnFamilies = tableDescriptor.getColumnFamilies();
                for (int i = 0; i < columnFamilies.length; i++) {
                    final HColumnDescriptor columnDescriptor = columnFamilies[i];
                    final String columnFamilyName = columnDescriptor.getNameAsString();
                    // HBase column families are always unstructured maps.
                    final ColumnType type = ColumnType.MAP;
                    final MutableColumn column = new MutableColumn(columnFamilyName, type);
                    column.setTable(this);
                    column.setColumnNumber(columnNumber);
View Full Code Here

    HRegionInfo info = null;
    try {
      FileSystem fs = Mockito.mock(FileSystem.class);
      Mockito.when(fs.exists((Path) Mockito.anyObject())).thenThrow(new IOException());
      HTableDescriptor htd = new HTableDescriptor(tableName);
      htd.addFamily(new HColumnDescriptor("cf"));
      info = new HRegionInfo(htd.getName(), HConstants.EMPTY_BYTE_ARRAY,
          HConstants.EMPTY_BYTE_ARRAY, false);
      Path path = new Path(DIR + "testStatusSettingToAbortIfAnyExceptionDuringRegionInitilization");
      // no where we are instantiating HStore in this test case so useTableNameGlobally is null. To
      // avoid NullPointerException we are setting useTableNameGlobally to false.
View Full Code Here

    byte [] row1 = Bytes.toBytes("row1");
    byte [] fam1 = Bytes.toBytes("fam1");
    byte [] qf1  = Bytes.toBytes("col");
    byte [] val1  = Bytes.toBytes("value1");
    // Create Table
    HColumnDescriptor hcd = new HColumnDescriptor(fam1)
        .setMaxVersions(Integer.MAX_VALUE)
        .setBloomFilterType(BloomType.ROWCOL);

    HTableDescriptor htd = new HTableDescriptor(tableName);
    htd.addFamily(hcd);
View Full Code Here

  public void testAllColumnsWithBloomFilter() throws IOException {
    byte [] TABLE = Bytes.toBytes("testAllColumnsWithBloomFilter");
    byte [] FAMILY = Bytes.toBytes("family");

    //Create table
    HColumnDescriptor hcd = new HColumnDescriptor(FAMILY)
        .setMaxVersions(Integer.MAX_VALUE)
        .setBloomFilterType(BloomType.ROWCOL);
    HTableDescriptor htd = new HTableDescriptor(TABLE);
    htd.addFamily(hcd);
    HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false);
View Full Code Here

  public void testDeleteRowWithBloomFilter() throws IOException {
    byte [] tableName = Bytes.toBytes("testDeleteRowWithBloomFilter");
    byte [] familyName = Bytes.toBytes("familyName");

    // Create Table
    HColumnDescriptor hcd = new HColumnDescriptor(familyName)
        .setMaxVersions(Integer.MAX_VALUE)
        .setBloomFilterType(BloomType.ROWCOL);

    HTableDescriptor htd = new HTableDescriptor(tableName);
    htd.addFamily(hcd);
View Full Code Here

      String callingMethod, Configuration conf, boolean isReadOnly, byte[]... families)
      throws IOException {
    HTableDescriptor htd = new HTableDescriptor(tableName);
    htd.setReadOnly(isReadOnly);
    for(byte [] family : families) {
      htd.addFamily(new HColumnDescriptor(family));
    }
    HRegionInfo info = new HRegionInfo(htd.getName(), startKey, stopKey, false);
    Path path = new Path(DIR + callingMethod);
    FileSystem fs = FileSystem.get(conf);
    if (fs.exists(path)) {
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.