public static Collection<String> getAllTables(Hive db, String dbName) throws HiveException { return Collections2.filter(db.getAllTables(dbName), tableName -> { assert tableName != null; return !tableName.toLowerCase().startsWith( SemanticAnalyzer.VALUES_TMP_TABLE_NAME_PREFIX.toLowerCase()); }); }
private boolean isDbEmpty(String dbName) throws HiveException { List<String> allTables = context.hiveDb.getAllTables(dbName); List<String> allFunctions = context.hiveDb.getFunctions(dbName, "*"); return allTables.isEmpty() && allFunctions.isEmpty(); }
private Iterable<? extends String> matchesTbl(String dbName, String tblPattern) throws HiveException { if (tblPattern == null) { return db.getAllTables(dbName); } else { return db.getTablesByPattern(dbName, tblPattern); } }
/** * Removes all databases and tables from the metastore */ public static void cleanupHMS(Hive hive, Warehouse wh, FsPermission defaultPerm) throws HiveException, MetaException, NoSuchObjectException { for (String dbName : hive.getAllDatabases()) { if (dbName.equals("default")) { continue; } try { Path path = getDbPath(hive, wh, dbName); FileSystem whFs = path.getFileSystem(hive.getConf()); whFs.setPermission(path, defaultPerm); } catch (IOException ex) { //ignore } hive.dropDatabase(dbName, true, true, true); } //clean tables in default db for (String tablename : hive.getAllTables("default")) { hive.dropTable("default", tablename, true, true); } }
tableNames = db.getAllTables(dbName); } catch (HiveException e) { throw new SemanticException(e);
tableNames = db.getAllTables(dbName); } catch (HiveException e) { throw new SemanticException(e);
for (String tableName : hm.getAllTables(dbName)) { Table table = hm.getTable(dbName, tableName); hm.dropTable(dbName, tableName);
for (String tableName : hm.getAllTables(dbName)) { Table table = hm.getTable(dbName, tableName); hm.dropTable(dbName, tableName);
for (String tblName : db.getAllTables()) { Table tblObj = null; try { for (String tblName : db.getAllTables()) { if (!DEFAULT_DATABASE_NAME.equals(dbName) || !srcTables.contains(tblName)) { Table tblObj = null;
/** * Get all table names for the current database. * @return List of table names * @throws HiveException */ public List<String> getAllTables() throws HiveException { return getAllTables(getCurrentDatabase()); }
/** * Imports all tables for the given db * @param databaseReferenceable * @param databaseName * @param failOnError * @throws Exception */ private int importTables(Referenceable databaseReferenceable, String databaseName, final boolean failOnError) throws Exception { int tablesImported = 0; List<String> hiveTables = hiveClient.getAllTables(databaseName); LOG.info("Importing tables {} for db {}", hiveTables.toString(), databaseName); for (String tableName : hiveTables) { int imported = importTable(databaseReferenceable, databaseName, tableName, failOnError); tablesImported += imported; } if (tablesImported == hiveTables.size()) { LOG.info("Successfully imported all {} tables from {} ", tablesImported, databaseName); } else { LOG.error("Able to import {} tables out of {} tables from {}. Please check logs for import errors", tablesImported, hiveTables.size(), databaseName); } return tablesImported; }
private Collection<String> getAllHiveTableNames() throws HiveException, LensException { if (!allTablesPopulated) { List<String> allTables = getClient().getAllTables(); for (String tblName : allTables) { // getTable call here would add the table to allHiveTables getTable(tblName); } allTablesPopulated = enableCaching; return allTables; } else { return allHiveTables.keySet(); } }
private Collection<String> getAllHiveTableNames() throws HiveException, LensException { if (!allTablesPopulated) { List<String> allTables = getClient().getAllTables(); for (String tblName : allTables) { // getTable call here would add the table to allHiveTables getTable(tblName); } allTablesPopulated = enableCaching; return allTables; } else { return allHiveTables.keySet(); } }
/** * Get all table names for the current database. * @return List of table names * @throws HiveException */ public List<String> getAllTables() throws HiveException { return getAllTables(SessionState.get().getCurrentDatabase()); }
LOG.info("results : " + tbls.size()); } else { tbls = db.getAllTables(dbName);
LOG.info("results : " + tbls.size()); } else { tbls = db.getAllTables(dbName);
tableNames = db.getAllTables(dbName); } catch (HiveException e) { throw new SemanticException(e);
ArrayList<ExternalTableMetaData> externalTables = new ArrayList<>(); for (String schema : schemas) { List<String> tables = hmc.getAllTables(schema); for (String tableName : tables) { try { ArrayList<PolicyTableData> policyData = new ArrayList<>(); for (String schema : schemas) { List<String> tables = hmc.getAllTables(schema); for (String tableName : tables) { try { HashMap<String, List<String>> dbTablesMap = new HashMap<>(); for (String db : dbList) { List<String> tables = hmc.getAllTables(db);