Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.tableExists()


    tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes("key")));
    tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes("familyone")));
    tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes("familytwo")));

    hAdmin.createTable(tableDesc);
    boolean doesTableExist = hAdmin.tableExists(tableName);
    assertTrue(doesTableExist);

    hcatDriver.run("drop table mytabletwo");
    CommandProcessorResponse response = hcatDriver
        .run("create external table mytabletwo(key int, valueone string, valuetwo string) STORED BY " +
View Full Code Here


    assertEquals(0, responseOne.getResponseCode());
    CommandProcessorResponse responseTwo = hcatDriver.run(tableQuery);
    assertEquals(0, responseTwo.getResponseCode());

    HBaseAdmin hAdmin = new HBaseAdmin(getHbaseConf());
    boolean doesTableExist = hAdmin.tableExists(hbaseTableName);
    assertTrue(doesTableExist);

    populateHBaseTable(hbaseTableName, 5);
    Configuration conf = new Configuration(hcatConf);
    conf.set(HCatConstants.HCAT_KEY_HIVE_CONF,
View Full Code Here

    String dropTableQuery = "DROP TABLE " + hbaseTableName ;
    CommandProcessorResponse responseThree = hcatDriver.run(dropTableQuery);
    assertEquals(0, responseThree.getResponseCode());

    boolean isHbaseTableThere = hAdmin.tableExists(hbaseTableName);
    assertFalse(isHbaseTableThere);

    String dropDB = "DROP DATABASE " + databaseName;
    CommandProcessorResponse responseFour = hcatDriver.run(dropDB);
    assertEquals(0, responseFour.getResponseCode());
View Full Code Here

    CommandProcessorResponse responseTwo = hcatDriver.run(tableQuery);
    assertEquals(0, responseTwo.getResponseCode());

    HBaseAdmin hAdmin = new HBaseAdmin(getHbaseConf());
    boolean doesTableExist = hAdmin.tableExists(hbaseTableName);
    assertTrue(doesTableExist);

    populateHBaseTable(hbaseTableName, 5);

    Configuration conf = new Configuration(hcatConf);
View Full Code Here

    String dropTableQuery = "DROP TABLE " + tableName;
    CommandProcessorResponse responseThree = hcatDriver.run(dropTableQuery);
    assertEquals(0, responseThree.getResponseCode());

    boolean isHbaseTableThere = hAdmin.tableExists(hbaseTableName);
    assertFalse(isHbaseTableThere);
  }


  static class MapReadHTable
View Full Code Here

    }

    protected void createSchema() throws IOException {
      HBaseAdmin admin = new HBaseAdmin(getConf());
      byte[] tableName = getTableName(getConf());
      if (!admin.tableExists(tableName)) {
        HTableDescriptor htd = new HTableDescriptor(getTableName(getConf()));
        htd.addFamily(new HColumnDescriptor(FAMILY_NAME));
        admin.createTable(htd);
      }
      admin.close();
View Full Code Here

  }
 
  @Override
  public void assertSchemaExists(String schemaName) throws Exception {
    HBaseAdmin admin = getTestDriver().getHbaseUtil().getHBaseAdmin();
    Assert.assertTrue(admin.tableExists(schemaName));
  }

  @Override
  public void assertPutArray() throws IOException {
    HTable table = new HTable("WebPage");
View Full Code Here

   * @param cfs the column families
   * @throws IOException
   */
  public void ensureTable(byte[] tableName, byte[][] cfs) throws IOException {
    HBaseAdmin admin = htu.getHBaseAdmin();
    if (!admin.tableExists(tableName)) {
      htu.createTable(tableName, cfs);
    }
  }

  /**
 
View Full Code Here

    // Check to see if the table exists.
    HTableDescriptor tableDesc = null;
    byte [] familyBytes = Bytes.toBytes(familyName);
    HColumnDescriptor colDesc = new HColumnDescriptor(familyBytes);
    if (!admin.tableExists(tableName)) {
      if (options.getCreateHBaseTable()) {
        // Create the table.
        LOG.info("Creating missing HBase table " + tableName);
        tableDesc =  new HTableDescriptor(tableName);
        tableDesc.addFamily(colDesc);
View Full Code Here

   * @throws IOException
   */
  private static void createTable(Configuration conf, String htableName, String... families) throws MasterNotRunningException, ZooKeeperConnectionException,
      IOException {
    HBaseAdmin hbase = new HBaseAdmin(conf);
    if (!hbase.tableExists(htableName)) {
      HTableDescriptor desc = new HTableDescriptor(htableName);
      for (String s : families) {
        HColumnDescriptor meta = new HColumnDescriptor(s);
        desc.addFamily(meta);
      }
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.