@Test public void testGetTables() { try { Logger logger = LoggerFactory.getLogger(HiveMetaExec.class); HiveMetaExec hiveMetaExec = new HiveMetaExec(logger); int times = 100; long start = System.currentTimeMillis(); for (int i = 0; i < times; ++i) { hiveMetaExec.getTables("dw"); } long end = System.currentTimeMillis(); System.out.println("get tables time(ms): " + (end - start) / times); start = System.currentTimeMillis(); for (int i = 0; i < times; ++i) { hiveMetaExec.getTableObjectsByName("dw"); } end = System.currentTimeMillis(); System.out.println("get tables objects time(ms): " + (end - start) / times); } catch (Exception e) { } }
public List<String> getTables(String dbname) throws Exception { HiveMetaStoreClient hiveMetaStoreClient = hiveMetaPoolClient.borrowClient(); try { return hiveMetaStoreClient.getAllTables(dbname); } catch (Exception e) { doWithException(hiveMetaStoreClient, e); throw e; } finally { if (hiveMetaStoreClient != null) { hiveMetaPoolClient.returnClient(hiveMetaStoreClient); } } }
HiveMetaExec { public List<String> getTables(String dbname) throws Exception { HiveMetaStoreClient hiveMetaStoreClient = hiveMetaPoolClient.borrowClient(); try { return hiveMetaStoreClient.getAllTables(dbname); } catch (Exception e) { doWithException(hiveMetaStoreClient, e); throw e; } finally { if (hiveMetaStoreClient != null) { hiveMetaPoolClient.returnClient(hiveMetaStoreClient); } } } }
HiveMetaExec { public List<String> getTables(String dbname) throws Exception { HiveMetaStoreClient hiveMetaStoreClient = hiveMetaPoolClient.borrowClient(); try { return hiveMetaStoreClient.getAllTables(dbname); } catch (Exception e) { doWithException(hiveMetaStoreClient, e); throw e; } finally { if (hiveMetaStoreClient != null) { hiveMetaPoolClient.returnClient(hiveMetaStoreClient); } } } HiveMetaExec(Logger logger); }
HiveMetaExec { public List<String> getTables(String dbname) throws Exception { HiveMetaStoreClient hiveMetaStoreClient = hiveMetaPoolClient.borrowClient(); try { return hiveMetaStoreClient.getAllTables(dbname); } catch (Exception e) { doWithException(hiveMetaStoreClient, e); throw e; } finally { if (hiveMetaStoreClient != null) { hiveMetaPoolClient.returnClient(hiveMetaStoreClient); } } } HiveMetaExec(Logger logger); List<HqlColumn> getHiveDesc(String dbName, String tableName); List<HqlColumn> checkHiveColumn(List<HiveColumn> srcColumn, List<HqlColumn> destColumn); List<FieldSchema> getPartionField(String dbName, String table); List<FieldSchema> getGeneralField(String dbName, String table); List<String> getTables(String dbname); List<Table> getTableObjectsByName(String dbname); }
HiveMetaExec { public List<String> getTables(String dbname) throws Exception { HiveMetaStoreClient hiveMetaStoreClient = hiveMetaPoolClient.borrowClient(); try { return hiveMetaStoreClient.getAllTables(dbname); } catch (Exception e) { doWithException(hiveMetaStoreClient, e); throw e; } finally { if (hiveMetaStoreClient != null) { hiveMetaPoolClient.returnClient(hiveMetaStoreClient); } } } HiveMetaExec(Logger logger); List<HqlColumn> getHiveDesc(String dbName, String tableName); List<HqlColumn> checkHiveColumn(List<HiveColumn> srcColumn, List<HqlColumn> destColumn); List<FieldSchema> getPartionField(String dbName, String table); List<FieldSchema> getGeneralField(String dbName, String table); List<String> getTables(String dbname); List<Table> getTableObjectsByName(String dbname);  }