@Override
  protected void analyzeCommand(TableName tableName, Map<String, String> partitionSpec, ASTNode command)
      throws SemanticException {
    List<Node> locationNodes = command.getChildren();
    if (locationNodes == null) {
      throw new SemanticException(ErrorMsg.ALTER_TBL_SKEWED_LOC_NO_LOC.getMsg());
    }

    Map<List<String>, String> locations = new HashMap<>();
    for (Node locationNode : locationNodes) {
      List<Node> locationListNodes = ((ASTNode) locationNode).getChildren();
      if (locationListNodes == null) {
        throw new SemanticException(ErrorMsg.ALTER_TBL_SKEWED_LOC_NO_LOC.getMsg());
      }

      for (Node locationListNode : locationListNodes) {
        List<Node> locationMapNodes = ((ASTNode) locationListNode).getChildren();
        if (locationMapNodes == null) {
          throw new SemanticException(ErrorMsg.ALTER_TBL_SKEWED_LOC_NO_LOC.getMsg());
        }

        for (Node locationMapNode : locationMapNodes) {
          List<Node> locationMapNodeMaps = ((ASTNode) locationMapNode).getChildren();
          if ((locationMapNodeMaps == null) || (locationMapNodeMaps.size() != 2)) {
            throw new SemanticException(ErrorMsg.ALTER_TBL_SKEWED_LOC_NO_MAP.getMsg());
          }

          List<String> keyList = new LinkedList<String>();
          ASTNode node = (ASTNode) locationMapNodeMaps.get(0);
          if (node.getToken().getType() == HiveParser.TOK_TABCOLVALUES) {
            keyList = SkewedTableUtils.getSkewedValuesFromASTNode(node);
          } else if (isConstant(node)) {
            keyList.add(PlanUtils.stripQuotes(node.getText()));
          } else {
            throw new SemanticException(ErrorMsg.SKEWED_TABLE_NO_COLUMN_VALUE.getMsg());
          }

          String newLocation =
              PlanUtils.stripQuotes(unescapeSQLString(((ASTNode) locationMapNodeMaps.get(1)).getText()));
          validateSkewedLocationString(newLocation);
          locations.put(keyList, newLocation);
          outputs.add(toWriteEntity(newLocation));
        }
      }
    }

    AbstractAlterTableDesc desc = new AlterTableSetSkewedLocationDesc(tableName, partitionSpec, locations);
    setAcidDdlDesc(getTable(tableName), desc);
    addInputsOutputsAlterTable(tableName, partitionSpec, desc, AlterTableType.SET_SKEWED_LOCATION, false);
    rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)));
  }
Analyzer for set skewed location commands.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/skewed/AlterTableSetSkewedLocationAnalyzer.java