private void processCTE(QB qb, ASTNode ctes, Map<String, CTEClause> aliasToCTEs) throws SemanticException {

    int numCTEs = ctes.getChildCount();

    for(int i=0; i <numCTEs; i++) {
      ASTNode cte = (ASTNode) ctes.getChild(i);
      ASTNode cteQry = (ASTNode) cte.getChild(0);
      String alias = unescapeIdentifier(cte.getChild(1).getText());
      ASTNode withColList = cte.getChildCount() == 3 ? (ASTNode) cte.getChild(2) : null;
      String qName = getAliasId(alias, qb);

      if ( aliasToCTEs.containsKey(qName)) {
        throw new SemanticException(ASTErrorUtils.getMsg(
            ErrorMsg.AMBIGUOUS_TABLE_ALIAS.getMsg(),
            cte.getChild(1)));
      }
      aliasToCTEs.put(qName, new CTEClause(qName, cteQry, withColList));
    }
  }
Goes though the tabref tree and finds the alias for the table. Once found,
it records the table name-> alias association in aliasToTabs. It also makes
an association from the alias to the table AST in parse info.

@return the alias of the table
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java