Search in sources :

Example 1 with WMMapping

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)));
}
Also used : DDLWork(org.apache.hadoop.hive.ql.plan.DDLWork) WMMapping(org.apache.hadoop.hive.metastore.api.WMMapping) DropWMMappingDesc(org.apache.hadoop.hive.ql.plan.DropWMMappingDesc)

Example 2 with WMMapping

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;
}
Also used : WMMapping(org.apache.hadoop.hive.metastore.api.WMMapping)

Example 3 with WMMapping

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);
    }
}
Also used : WMMapping(org.apache.hadoop.hive.metastore.api.WMMapping)

Example 4 with WMMapping

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)));
}
Also used : DDLWork(org.apache.hadoop.hive.ql.plan.DDLWork) CreateOrAlterWMMappingDesc(org.apache.hadoop.hive.ql.plan.CreateOrAlterWMMappingDesc) WMMapping(org.apache.hadoop.hive.metastore.api.WMMapping) CommonTree(org.antlr.runtime.tree.CommonTree) Tree(org.antlr.runtime.tree.Tree)

Example 5 with WMMapping

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);
}
Also used : WMMapping(org.apache.hadoop.hive.metastore.api.WMMapping)

Aggregations

WMMapping (org.apache.hadoop.hive.metastore.api.WMMapping)5 DDLWork (org.apache.hadoop.hive.ql.plan.DDLWork)2 CommonTree (org.antlr.runtime.tree.CommonTree)1 Tree (org.antlr.runtime.tree.Tree)1 CreateOrAlterWMMappingDesc (org.apache.hadoop.hive.ql.plan.CreateOrAlterWMMappingDesc)1 DropWMMappingDesc (org.apache.hadoop.hive.ql.plan.DropWMMappingDesc)1