Search in sources :

Example 1 with CreateOrAlterWMMappingDesc

use of org.apache.hadoop.hive.ql.plan.CreateOrAlterWMMappingDesc 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)

Aggregations

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