use of org.apache.hadoop.hive.metastore.api.WMMapping in project hive by apache.
the class DDLSemanticAnalyzer method analyzeDropMapping.
private void analyzeDropMapping(ASTNode ast) throws SemanticException {
if (ast.getChildCount() != 3) {
throw new SemanticException("Invalid syntax for drop mapping.");
}
String rpName = unescapeIdentifier(ast.getChild(0).getText());
String entityType = ast.getChild(1).getText();
String entityName = PlanUtils.stripQuotes(ast.getChild(2).getText());
DropWMMappingDesc desc = new DropWMMappingDesc(new WMMapping(rpName, entityType, entityName));
addServiceOutput();
rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)));
}
use of org.apache.hadoop.hive.metastore.api.WMMapping in project hive by apache.
the class TestWorkloadManager method mapping.
public static WMMapping mapping(String type, String user, String pool, int ordering) {
WMMapping mapping = new WMMapping("rp", type, user);
mapping.setPoolPath(pool);
mapping.setOrdering(ordering);
return mapping;
}
use of org.apache.hadoop.hive.metastore.api.WMMapping in project hive by apache.
the class UserPoolMapping method addMapping.
private static void addMapping(WMMapping mapping, Map<String, Mapping> map, String text) {
Mapping val = new Mapping(mapping.getPoolPath(), mapping.getOrdering());
Mapping oldValue = map.put(mapping.getEntityName(), val);
if (oldValue != null) {
throw new AssertionError("Duplicate mapping for " + text + " " + mapping.getEntityName() + "; " + oldValue + " and " + val);
}
}
use of org.apache.hadoop.hive.metastore.api.WMMapping in project hive by apache.
the class DDLSemanticAnalyzer method analyzeCreateOrAlterMapping.
private void analyzeCreateOrAlterMapping(ASTNode ast, boolean update) throws SemanticException {
if (ast.getChildCount() < 4) {
throw new SemanticException("Invalid syntax for create or alter mapping.");
}
String rpName = unescapeIdentifier(ast.getChild(0).getText());
String entityType = ast.getChild(1).getText();
String entityName = PlanUtils.stripQuotes(ast.getChild(2).getText());
WMMapping mapping = new WMMapping(rpName, entityType, entityName);
Tree dest = ast.getChild(3);
if (dest.getType() != HiveParser.TOK_UNMANAGED) {
mapping.setPoolPath(poolPath(dest));
}
// Null path => unmanaged
if (ast.getChildCount() == 5) {
mapping.setOrdering(Integer.valueOf(ast.getChild(4).getText()));
}
CreateOrAlterWMMappingDesc desc = new CreateOrAlterWMMappingDesc(mapping, update);
addServiceOutput();
rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)));
}
use of org.apache.hadoop.hive.metastore.api.WMMapping in project hive by apache.
the class TestJsonRPFormatter method addMapping.
private void addMapping(WMFullResourcePlan fullRp, String type, String name, String poolName) {
WMMapping mapping = new WMMapping(fullRp.getPlan().getName(), type, name);
mapping.setPoolPath(poolName);
fullRp.addToMappings(mapping);
}
Aggregations