@Override
  public void analyzeInternal(ASTNode root) throws SemanticException {
    if (root.getChildCount() == 0) {
      throw new SemanticException("Expected name in CREATE RESOURCE PLAN statement");
    }

    String resourcePlanName = unescapeIdentifier(root.getChild(0).getText());
    Integer queryParallelism = null;
    String likeName = null;
    boolean ifNotExists = false;

    for (int i = 1; i < root.getChildCount(); ++i) {
      Tree child = root.getChild(i);
      switch (child.getType()) {
      case HiveParser.TOK_QUERY_PARALLELISM:
        // Note: later we may be able to set multiple things together (except LIKE).
        if (queryParallelism == null && likeName == null) {
          queryParallelism = Integer.parseInt(child.getChild(0).getText());
        } else {
          throw new SemanticException("Conflicting create arguments " + root.toStringTree());
        }
        break;
      case HiveParser.TOK_LIKERP:
        if (queryParallelism == null && likeName == null) {
          likeName = unescapeIdentifier(child.getChild(0).getText());
        } else {
          throw new SemanticException("Conflicting create arguments " + root.toStringTree());
        }
        break;
      case HiveParser.TOK_IFNOTEXISTS:
        ifNotExists = true;
        break;
      default:
        throw new SemanticException("Invalid create arguments " + root.toStringTree());
      }
    }

    CreateResourcePlanDesc desc = new CreateResourcePlanDesc(resourcePlanName, queryParallelism, likeName, ifNotExists);
    rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)));

    DDLUtils.addServiceOutput(conf, getOutputs());
  }
Analyzer for create resource plan commands.
ql/src/java/org/apache/hadoop/hive/ql/ddl/workloadmanagement/resourceplan/create/CreateResourcePlanAnalyzer.java