use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class ObjectStore method fromMResourcePlan.
private WMResourcePlan fromMResourcePlan(MWMResourcePlan mplan) {
if (mplan == null) {
return null;
}
WMResourcePlan rp = new WMResourcePlan();
rp.setName(mplan.getName());
rp.setStatus(WMResourcePlanStatus.valueOf(mplan.getStatus().name()));
if (mplan.getQueryParallelism() != null) {
rp.setQueryParallelism(mplan.getQueryParallelism());
}
if (mplan.getDefaultPool() != null) {
rp.setDefaultPoolPath(mplan.getDefaultPool().getPath());
}
return rp;
}
use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class JsonMetaDataFormatter method showResourcePlans.
@Override
public void showResourcePlans(DataOutputStream out, List<WMResourcePlan> resourcePlans) throws HiveException {
JsonGenerator generator = null;
try {
generator = new ObjectMapper().getJsonFactory().createJsonGenerator(out);
generator.writeStartArray();
for (WMResourcePlan plan : resourcePlans) {
generator.writeStartObject();
generator.writeStringField("name", plan.getName());
generator.writeStringField("status", plan.getStatus().name());
if (plan.isSetQueryParallelism()) {
generator.writeNumberField("queryParallelism", plan.getQueryParallelism());
}
if (plan.isSetDefaultPoolPath()) {
generator.writeStringField("defaultPoolPath", plan.getDefaultPoolPath());
}
generator.writeEndObject();
}
generator.writeEndArray();
generator.close();
} catch (IOException e) {
throw new HiveException(e);
} finally {
if (generator != null) {
IOUtils.closeQuietly(generator);
}
}
}
use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class TestJsonRPFormatter method createRP.
private WMFullResourcePlan createRP(String name, Integer parallelism, String defaultPoolPath) {
WMResourcePlan rp = new WMResourcePlan(name);
rp.setStatus(WMResourcePlanStatus.ACTIVE);
if (parallelism != null) {
rp.setQueryParallelism(parallelism);
}
if (defaultPoolPath != null) {
rp.setDefaultPoolPath(defaultPoolPath);
}
WMFullResourcePlan fullRp = new WMFullResourcePlan(rp, new ArrayList<>());
return fullRp;
}
use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class TestTriggersNoTezSessionPool method setupTriggers.
@Override
void setupTriggers(final List<Trigger> triggers) throws Exception {
WMFullResourcePlan rp = new WMFullResourcePlan(new WMResourcePlan("rp"), null);
for (Trigger trigger : triggers) {
WMTrigger wmTrigger = wmTriggerFromTrigger(trigger);
wmTrigger.setIsInUnmanaged(true);
rp.addToTriggers(wmTrigger);
}
TezSessionPoolManager.getInstance().updateTriggers(rp);
}
use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class TestTriggersTezSessionPoolManager method setupTriggers.
@Override
protected void setupTriggers(final List<Trigger> triggers) throws Exception {
WMFullResourcePlan rp = new WMFullResourcePlan(new WMResourcePlan("rp"), null);
for (Trigger trigger : triggers) {
WMTrigger wmTrigger = wmTriggerFromTrigger(trigger);
wmTrigger.setIsInUnmanaged(true);
rp.addToTriggers(wmTrigger);
}
TezSessionPoolManager.getInstance().updateTriggers(rp);
}
Aggregations