} catch (Exception e) { if (c != null) { c.invalidate();
@Override ObjectMapping doTask() throws Exception { List<Partition> tblParts; HMSClient c = null; try (HMSClient client = clientFactory.connect()) { c = client; tblParts = client.getClient().getPartitionsByNames(dbName, tblName, partNames); } catch (Exception e) { if (c != null) { c.invalidate(); } throw e; } LOGGER.debug("Fetched partitions for db = {}, table = {}", dbName, tblName); Collection<String> partitionNames = new ArrayList<>(tblParts.size()); for (Partition part : tblParts) { if(part != null && part.getSd() != null) { String partPath = pathFromURI(part.getSd().getLocation()); if (partPath != null) { partitionNames.add(partPath.intern()); } } else { LOGGER.info("Partition or its storage descriptor is null while fetching partitions for db = {} table = {}", dbName, tblName); } } return new ObjectMapping(authName, partitionNames); } }
} catch (Exception e) { if (c != null) { c.invalidate();
@Override ObjectMapping doTask() throws Exception { HMSClient c = null; try (HMSClient client = clientFactory.connect()) { c = client; Database db = client.getClient().getDatabase(dbName); if (!dbName.equalsIgnoreCase(db.getName())) { LOGGER.warn("Database name {} does not match {}", db.getName(), dbName); return emptyObjectMapping; } List<String> allTblStr = client.getClient().getAllTables(dbName); // Count total number of tables tableCount.inc(allTblStr.size()); for (int i = 0; i < allTblStr.size(); i += maxTablesPerCall) { List<String> tablesToFetch = allTblStr.subList(i, Math.min(i + maxTablesPerCall, allTblStr.size())); Callable<CallResult> tableTask = new TableTask(db, tablesToFetch); results.add(threadPool.submit(tableTask)); } String dbPath = safeIntern(pathFromURI(db.getLocationUri())); return (dbPath != null) ? new ObjectMapping(dbName, dbPath) : emptyObjectMapping; } catch (Exception e) { if (c != null) { c.invalidate(); } throw e; } } }