@Test public void testDeleteTable() throws Exception { TableMeta meta = new TableMeta(CatalogProtos.StoreType.CSV, new Options()); org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema(); schema.addColumn("n_name", TajoDataTypes.Type.TEXT); schema.addColumn("n_regionkey", TajoDataTypes.Type.INT4); schema.addColumn("n_comment", TajoDataTypes.Type.TEXT); String tableName = "table1"; TableDesc table = new TableDesc(DB_NAME + "." + tableName, schema, meta, warehousePath); store.addTable(table.getProto()); assertTrue(store.existTable(table.getName())); TableDesc table1 = new TableDesc(store.getTable(table.getName())); FileSystem fs = FileSystem.getLocal(new Configuration()); assertTrue(fs.exists(table1.getPath())); store.deleteTable(table1.getName()); assertFalse(store.existTable(table1.getName())); fs.close(); }
@Override public final void deleteTable(final String name) throws CatalogException { String dbName = null, tableName = null; Pair<String, String> tablePair = null; HCatalogStoreClientPool.HCatalogStoreClient client = null; try { tablePair = HCatUtil.getDbAndTableName(name); dbName = tablePair.first; tableName = tablePair.second; } catch (Exception ioe) { throw new CatalogException("Table name is wrong.", ioe); } try { client = clientPool.getClient(); client.getHiveClient().dropTable(dbName, tableName, false, false); } catch (NoSuchObjectException nsoe) { } catch (Exception e) { throw new CatalogException(e); } finally { client.release(); } }
HCatalogStore extends CatalogConstants implements CatalogStore { @Override public final void deleteTable(final String name) throws CatalogException { String dbName = null, tableName = null; Pair<String, String> tablePair = null; HCatalogStoreClientPool.HCatalogStoreClient client = null; try { tablePair = HCatUtil.getDbAndTableName(name); dbName = tablePair.first; tableName = tablePair.second; } catch (Exception ioe) { throw new CatalogException("Table name is wrong.", ioe); } try { client = clientPool.getClient(); client.getHiveClient().dropTable(dbName, tableName, false, false); } catch (NoSuchObjectException nsoe) { } catch (Exception e) { throw new CatalogException(e); } finally { client.release(); } } }
HCatalogStore extends CatalogConstants implements CatalogStore { @Override public final void deleteTable(final String name) throws CatalogException { String dbName = null, tableName = null; Pair<String, String> tablePair = null; HCatalogStoreClientPool.HCatalogStoreClient client = null; try { tablePair = HCatUtil.getDbAndTableName(name); dbName = tablePair.first; tableName = tablePair.second; } catch (Exception ioe) { throw new CatalogException("Table name is wrong.", ioe); } try { client = clientPool.getClient(); client.getHiveClient().dropTable(dbName, tableName, false, false); } catch (NoSuchObjectException nsoe) { } catch (Exception e) { throw new CatalogException(e); } finally { client.release(); } } HCatalogStore(final Configuration conf);  HCatalogStore(final Configuration conf, HCatalogStoreClientPool pool); }
HCatalogStore extends CatalogConstants implements CatalogStore { @Override public final void deleteTable(final String name) throws CatalogException { String dbName = null, tableName = null; Pair<String, String> tablePair = null; HCatalogStoreClientPool.HCatalogStoreClient client = null; try { tablePair = HCatUtil.getDbAndTableName(name); dbName = tablePair.first; tableName = tablePair.second; } catch (Exception ioe) { throw new CatalogException("Table name is wrong.", ioe); } try { client = clientPool.getClient(); client.getHiveClient().dropTable(dbName, tableName, false, false); } catch (NoSuchObjectException nsoe) { } catch (Exception e) { throw new CatalogException(e); } finally { client.release(); } } HCatalogStore(final Configuration conf);  HCatalogStore(final Configuration conf, HCatalogStoreClientPool pool); @Override boolean existTable(final String name); @Override final CatalogProtos.TableDescProto getTable(final String name); @Override final List<String> getAllTableNames(); @Override final void addTable(final CatalogProtos.TableDescProto tableDescProto); @Override final void deleteTable(final String name); @Override void addPartitionMethod(CatalogProtos.PartitionMethodProto partitionMethodProto); @Override CatalogProtos.PartitionMethodProto getPartitionMethod(String tableName); @Override boolean existPartitionMethod(String tableName); @Override void delPartitionMethod(String tableName); @Override void addPartitions(CatalogProtos.PartitionsProto partitionsProto); @Override void addPartition(CatalogProtos.PartitionDescProto partitionDescProto); @Override CatalogProtos.PartitionsProto getPartitions(String tableName); @Override CatalogProtos.PartitionDescProto getPartition(String partitionName); @Override void delPartition(String partitionName); @Override void delPartitions(String tableName); @Override final void addFunction(final FunctionDesc func); @Override final void deleteFunction(final FunctionDesc func); @Override final void existFunction(final FunctionDesc func); @Override final List<String> getAllFunctionNames(); @Override void delIndex(String indexName); @Override boolean existIndex(String indexName); @Override CatalogProtos.IndexDescProto[] getIndexes(String tableName); @Override void addIndex(CatalogProtos.IndexDescProto proto); @Override CatalogProtos.IndexDescProto getIndex(String indexName); @Override CatalogProtos.IndexDescProto getIndex(String tableName, String columnName); @Override boolean existIndex(String tableName, String columnName); @Override final void close(); }
HCatalogStore extends CatalogConstants implements CatalogStore { @Override public final void deleteTable(final String name) throws CatalogException { String dbName = null, tableName = null; Pair<String, String> tablePair = null; HCatalogStoreClientPool.HCatalogStoreClient client = null; try { tablePair = HCatUtil.getDbAndTableName(name); dbName = tablePair.first; tableName = tablePair.second; } catch (Exception ioe) { throw new CatalogException("Table name is wrong.", ioe); } try { client = clientPool.getClient(); client.getHiveClient().dropTable(dbName, tableName, false, false); } catch (NoSuchObjectException nsoe) { } catch (Exception e) { throw new CatalogException(e); } finally { client.release(); } } HCatalogStore(final Configuration conf);  HCatalogStore(final Configuration conf, HCatalogStoreClientPool pool); @Override boolean existTable(final String name); @Override final CatalogProtos.TableDescProto getTable(final String name); @Override final List<String> getAllTableNames(); @Override final void addTable(final CatalogProtos.TableDescProto tableDescProto); @Override final void deleteTable(final String name); @Override void addPartitionMethod(CatalogProtos.PartitionMethodProto partitionMethodProto); @Override CatalogProtos.PartitionMethodProto getPartitionMethod(String tableName); @Override boolean existPartitionMethod(String tableName); @Override void delPartitionMethod(String tableName); @Override void addPartitions(CatalogProtos.PartitionsProto partitionsProto); @Override void addPartition(CatalogProtos.PartitionDescProto partitionDescProto); @Override CatalogProtos.PartitionsProto getPartitions(String tableName); @Override CatalogProtos.PartitionDescProto getPartition(String partitionName); @Override void delPartition(String partitionName); @Override void delPartitions(String tableName); @Override final void addFunction(final FunctionDesc func); @Override final void deleteFunction(final FunctionDesc func); @Override final void existFunction(final FunctionDesc func); @Override final List<String> getAllFunctionNames(); @Override void delIndex(String indexName); @Override boolean existIndex(String indexName); @Override CatalogProtos.IndexDescProto[] getIndexes(String tableName); @Override void addIndex(CatalogProtos.IndexDescProto proto); @Override CatalogProtos.IndexDescProto getIndex(String indexName); @Override CatalogProtos.IndexDescProto getIndex(String tableName, String columnName); @Override boolean existIndex(String tableName, String columnName); @Override final void close();  }