Package org.apache.hadoop.hbase.client

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


    Configuration hConf = injector.getInstance(Configuration.class);
    HBaseAdmin hAdmin = new HBaseAdmin(hConf);
    final HBaseTableUtil hBaseTableUtil = injector.getInstance(HBaseTableUtil.class);

    for (HTableDescriptor desc : hAdmin.listTables()) {
      String tableName = desc.getNameAsString();
      // todo: it works now, but we will want to change it if namespacing of datasets in HBase is more than +prefix
      if (namespace.fromNamespaced(tableName) != null) {
        System.out.println(String.format("Upgrading hbase table: %s, desc: %s", tableName, desc.toString()));
View Full Code Here


   
    @Test
    public void testCreateTenantSpecificTable() throws Exception {
        // ensure we didn't create a physical HBase table for the tenant-specific table
        HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES).getAdmin();
        assertEquals(0, admin.listTables(TENANT_TABLE_NAME).length);
    }
   
    @Test
    public void testCreateTenantTableTwice() throws Exception {
        try {
View Full Code Here

      }

      if (admin.isTableDisabled(TEST_TABLE)) {
         admin.enableTable(TEST_TABLE);
      }
      HTableDescriptor[] tables = admin.listTables();
      for (HTableDescriptor t : tables) {
         LOG.info(t.getNameAsString());
      }
   }
View Full Code Here

    @Override
    public HResultSet executeQuery(HPreparedStatementImpl statement) throws SQLException {
        try {
            HBaseAdmin admin = statement.getConnection().getEngine().getHBaseAdmin();

            HTableDescriptor[] tables = admin.listTables();

            return new ShowTableResultSet(statement, tables);
        } catch (SQLException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

    helper.createTable("testtable3", "colfam1", "colfam2", "colfam3");

    // vv ListTablesExample
    HBaseAdmin admin = new HBaseAdmin(conf);

    HTableDescriptor[] htds = admin.listTables();
    // ^^ ListTablesExample
    System.out.println("Printing all tables...");
    // vv ListTablesExample
    for (HTableDescriptor htd : htds) {
      System.out.println(htd);
View Full Code Here

    PrivilegedExceptionAction listTablesAction = new PrivilegedExceptionAction() {
      public Object run() throws Exception {
        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
        try {
          admin.listTables();
        } finally {
          admin.close();
        }
        return null;
      }
View Full Code Here

        try {
            final HBaseAdmin admin = conn.getHBaseAdmin();

            final ExecutionResults retval = new ExecutionResults();
            retval.out.println("Tables: ");
            for (final HTableDescriptor tableDesc : admin.listTables())
                retval.out.println("\t" + tableDesc.getNameAsString());

            retval.out.flush();
            return retval;
        }
View Full Code Here

    public Set<String> getTableNames() throws HBqlException {
        try {
            final HBaseAdmin admin = this.getHBaseAdmin();
            final Set<String> tableSet = Sets.newHashSet();
            for (final HTableDescriptor table : admin.listTables())
                tableSet.add(table.getNameAsString());
            return tableSet;
        }
        catch (IOException e) {
            throw new HBqlException(e);
View Full Code Here

  public String[] getTableList(Connection conn) throws CruxException {
    logger.debug("Getting table list for " + conn);
    HBaseAdmin admin = getHBaseAdmin(conn);
    HTableDescriptor[] tableDescriptor;
    try {
      tableDescriptor = admin.listTables();
     
    } catch (IOException e) {
      throw new CruxException(e);
    }
    int length = tableDescriptor.length;
View Full Code Here

    super.setUp();
  }
 
  public void deleteAllTables() throws Exception {
    HBaseAdmin admin = hbaseUtil.getHBaseAdmin();
    for(HTableDescriptor table:admin.listTables()) {
      admin.disableTable(table.getName());
      admin.deleteTable(table.getName());
    }
  }
 
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.