private void startMultiTableFunction(String function, String db, List<String> tbls) { String tableNames = join(tbls, ","); startFunction(function, " : db=" + db + " tbls=" + tableNames); }
private void startPartitionFunction(String function, String cat, String db, String tbl, List<String> partVals) { startFunction(function, " : tbl=" + TableName.getQualified(cat, db, tbl) + "[" + join(partVals, ",") + "]"); }
@Override public GetCatalogsResponse get_catalogs() throws MetaException { startFunction("get_catalogs"); List<String> ret = null; Exception ex = null; try { ret = getMS().getCatalogs(); } catch (MetaException e) { ex = e; throw e; } finally { endFunction("get_catalog", ret != null, ex); } return new GetCatalogsResponse(ret == null ? Collections.emptyList() : ret); }
@Override public List<String> get_master_keys() throws TException { startFunction("get_master_keys."); Exception ex = null; String [] ret = null; try { ret = getMS().getMasterKeys(); } catch (MetaException e) { ex = e; throw e; } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("get_master_keys.", ret != null, ex); } return Arrays.asList(ret); }
@Override public GetCatalogResponse get_catalog(GetCatalogRequest rqst) throws NoSuchObjectException, TException { String catName = rqst.getName(); startFunction("get_catalog", ": " + catName); Catalog cat = null; Exception ex = null; try { cat = getMS().getCatalog(catName); firePreEvent(new PreReadCatalogEvent(this, cat)); return new GetCatalogResponse(cat); } catch (MetaException|NoSuchObjectException e) { ex = e; throw e; } finally { endFunction("get_catalog", cat != null, ex); } }
@Override public void cancel_delegation_token(String token_str_form) throws TException { startFunction("cancel_delegation_token"); boolean success = false; Exception ex = null; try { HiveMetaStore.cancelDelegationToken(token_str_form); success = true; } catch (IOException e) { ex = e; throw new MetaException(e.getMessage()); } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("cancel_delegation_token", success, ex); } }
@Override public List<String> get_functions(String dbName, String pattern) throws MetaException { startFunction("get_functions", ": db=" + dbName + " pat=" + pattern); RawStore ms = getMS(); Exception ex = null; List<String> funcNames = null; String[] parsedDbName = parseDbName(dbName, conf); try { funcNames = ms.getFunctions(parsedDbName[CAT_NAME], parsedDbName[DB_NAME], pattern); } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("get_functions", funcNames != null, ex); } return funcNames; }
@Override public int add_master_key(String key) throws TException { startFunction("add_master_key."); int ret; Exception ex = null; try { ret = getMS().addMasterKey(key); } catch (MetaException e) { ex = e; throw e; } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("add_master_key.", ex == null, ex); } return ret; }
@Override public boolean remove_token(String token_identifier) throws TException { startFunction("remove_token", ": " + token_identifier); boolean ret = false; Exception ex = null; try { ret = getMS().removeToken(token_identifier); } catch (MetaException e) { ex = e; throw e; } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("remove_token", ret == true, ex); } return ret; }
@Override public boolean remove_master_key(int key_seq) throws TException { startFunction("remove_master_key."); Exception ex = null; boolean ret; try { ret = getMS().removeMasterKey(key_seq); } catch (MetaException e) { ex = e; throw e; } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("remove_master_key.", ex == null, ex); } return ret; }
@Override public Type get_type(final String name) throws MetaException, NoSuchObjectException { startFunction("get_type", ": " + name); Type ret = null; Exception ex = null; try { ret = getMS().getType(name); if (null == ret) { throw new NoSuchObjectException("Type \"" + name + "\" not found."); } } catch (Exception e) { ex = e; throwMetaException(e); } finally { endFunction("get_type", ret != null, ex); } return ret; }
@Override public Database get_database(final String name) throws NoSuchObjectException, MetaException { startFunction("get_database", ": " + name); Database db = null; Exception ex = null; try { String[] parsedDbName = parseDbName(name, conf); db = get_database_core(parsedDbName[CAT_NAME], parsedDbName[DB_NAME]); firePreEvent(new PreReadDatabaseEvent(db, this)); } catch (MetaException|NoSuchObjectException e) { ex = e; throw e; } finally { endFunction("get_database", db != null, ex); } return db; }
@Override public boolean drop_type(final String name) throws MetaException, NoSuchObjectException { startFunction("drop_type", ": " + name); boolean success = false; Exception ex = null; try { // TODO:pc validate that there are no types that refer to this success = getMS().dropType(name); } catch (Exception e) { ex = e; throwMetaException(e); } finally { endFunction("drop_type", success, ex); } return success; }
@Override public List<RuntimeStat> get_runtime_stats(GetRuntimeStatsRequest rqst) throws TException { startFunction("get_runtime_stats"); Exception ex = null; try { List<RuntimeStat> res = getMS().getRuntimeStats(rqst.getMaxWeight(), rqst.getMaxCreateTime()); return res; } catch (MetaException e) { LOG.error("Caught exception", e); ex = e; throw e; } finally { endFunction("get_runtime_stats", ex == null, ex); } } }
@Override public void update_master_key(int seq_number, String key) throws TException { startFunction("update_master_key."); Exception ex = null; try { getMS().updateMasterKey(seq_number, key); } catch (MetaException e) { ex = e; throw e; } catch (Exception e) { ex = e; throw newMetaException(e); } finally { endFunction("update_master_key.", ex == null, ex); } }
private String startFunction(String function) { return startFunction(function, ""); }
private void startTableFunction(String function, String catName, String db, String tbl) { startFunction(function, " : tbl=" + TableName.getQualified(catName, db, tbl)); }
@Override public Map<String, Type> get_type_all(String name) throws MetaException { // TODO Auto-generated method stub startFunction("get_type_all", ": " + name); endFunction("get_type_all", false, null); throw new MetaException("Not yet implemented"); }
private void startPartitionFunction(String function, String catName, String db, String tbl, Map<String, String> partName) { startFunction(function, " : tbl=" + TableName.getQualified(catName, db, tbl) + "partition=" + partName); }
@Override public String getVersion() throws TException { endFunction(startFunction("getVersion"), true, null); return "3.0"; }