private ASTNode getChildFromSubqueryAST(String errorMsg, int type) throws SemanticException {
    ASTNode childAST = (ASTNode) subQueryAST.getFirstChildWithType(type);
    if (childAST == null && errorMsg != null) {
      subQueryAST.setOrigin(originalSQASTOrigin);
      throw new SemanticException(ASTErrorUtils.getMsg(
          ErrorMsg.INVALID_SUBQUERY_EXPRESSION.getMsg(),
          subQueryAST, errorMsg + " clause is missing in SubQuery."));
    }
    return childAST;
  }
@param parentQueryRR
@param forHavingClause
@param outerQueryAlias
@return true if it is correlated scalar subquery with an aggregate
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java