use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.
the class HiveServer2 method createTestResourcePlan.
private WMFullResourcePlan createTestResourcePlan() {
WMFullResourcePlan resourcePlan;
WMPool pool = new WMPool("testDefault", "llap");
pool.setAllocFraction(1f);
pool.setQueryParallelism(1);
resourcePlan = new WMFullResourcePlan(new WMResourcePlan("testDefault"), Lists.newArrayList(pool));
resourcePlan.getPlan().setDefaultPoolPath("testDefault");
return resourcePlan;
}
use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.
the class ObjectStore method fullFromMResourcePlan.
private WMFullResourcePlan fullFromMResourcePlan(MWMResourcePlan mplan) {
if (mplan == null) {
return null;
}
WMFullResourcePlan rp = new WMFullResourcePlan();
rp.setPlan(fromMResourcePlan(mplan));
for (MWMPool mPool : mplan.getPools()) {
rp.addToPools(fromMPool(mPool, mplan.getName()));
for (MWMTrigger mTrigger : mPool.getTriggers()) {
rp.addToPoolTriggers(new WMPoolTrigger(mPool.getPath(), mTrigger.getName()));
}
}
for (MWMTrigger mTrigger : mplan.getTriggers()) {
rp.addToTriggers(fromMWMTrigger(mTrigger, mplan.getName()));
}
for (MWMMapping mMapping : mplan.getMappings()) {
rp.addToMappings(fromMMapping(mMapping, mplan.getName()));
}
return rp;
}
use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.
the class ObjectStore method alterResourcePlan.
@Override
public WMFullResourcePlan alterResourcePlan(String name, String ns, WMNullableResourcePlan changes, boolean canActivateDisabled, boolean canDeactivate, boolean isReplace) throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException, MetaException {
name = name == null ? null : normalizeIdentifier(name);
if (isReplace && name == null) {
throw new InvalidOperationException("Cannot replace without specifying the source plan");
}
boolean commited = false;
Query query = null;
// This method only returns the result when activating a resource plan.
// We could also add a boolean flag to be specified by the caller to see
// when the result might be needed.
WMFullResourcePlan result = null;
try {
openTransaction();
if (isReplace) {
result = handleAlterReplace(name, ns, changes);
} else {
result = handleSimpleAlter(name, ns, changes, canActivateDisabled, canDeactivate);
}
commited = commitTransaction();
return result;
} catch (Exception e) {
checkForConstraintException(e, "Resource plan name should be unique: ");
throw e;
} finally {
rollbackAndCleanup(commited, query);
}
}
Aggregations