Program: 25191
Project: 25191
Buggy source:
/** 
 * Analyze internal.
 * @throws SemanticException the semantic exception
 */
public void analyzeInternal(Configuration conf,HiveConf hconf) throws SemanticException {
  CubeSemanticAnalyzer c1=new CubeSemanticAnalyzer(conf,hconf);
  QB qb=new QB(null,null,false);
  if (!c1.doPhase1(ast,qb,c1.initPhase1Ctx(),null)) {
    return;
  }
  if (!qb.getSubqAliases().isEmpty()) {
    log.warn("String_Node_Str",this,this.query);
    throw new SemanticException("String_Node_Str" + this + "String_Node_Str"+ this.query);
  }
  TreeSet<String> ks=new TreeSet<String>(qb.getParseInfo().getClauseNames());
  String clauseName=ks.first();
  if (qb.getParseInfo().getJoinExpr() != null) {
    log.warn("String_Node_Str",this,this.query);
    throw new SemanticException("String_Node_Str" + this + "String_Node_Str"+ this.query);
  }
  if (qb.getParseInfo().getWhrForClause(clauseName) != null) {
    this.whereAST=qb.getParseInfo().getWhrForClause(clauseName);
  }
  if (qb.getParseInfo().getHavingForClause(clauseName) != null) {
    this.havingAST=qb.getParseInfo().getHavingForClause(clauseName);
  }
  if (qb.getParseInfo().getOrderByForClause(clauseName) != null) {
    this.orderByAST=qb.getParseInfo().getOrderByForClause(clauseName);
  }
  if (qb.getParseInfo().getGroupByForClause(clauseName) != null) {
    this.groupByAST=qb.getParseInfo().getGroupByForClause(clauseName);
  }
  if (qb.getParseInfo().getSelForClause(clauseName) != null) {
    this.selectAST=qb.getParseInfo().getSelForClause(clauseName);
  }
  this.fromAST=HQLParser.findNodeByPath(ast,TOK_FROM);
}

Fixed version (ground truth):
/** 
 * Analyze internal.
 * @throws SemanticException the semantic exception
 */
public void analyzeInternal(Configuration conf,HiveConf hconf) throws SemanticException {
  CubeSemanticAnalyzer c1=new CubeSemanticAnalyzer(conf,hconf);
  QB qb=new QB(null,null,false);
  if (!c1.doPhase1(ast,qb,c1.initPhase1Ctx(),null)) {
    return;
  }
  if (!qb.getSubqAliases().isEmpty()) {
    log.warn("String_Node_Str",this,this.query);
    throw new SemanticException("String_Node_Str" + this + "String_Node_Str"+ this.query);
  }
  TreeSet<String> ks=new TreeSet<String>(qb.getParseInfo().getClauseNames());
  String clauseName=ks.first();
  if (qb.getParseInfo().getJoinExpr() != null) {
    log.warn("String_Node_Str",this,this.query);
    throw new SemanticException("String_Node_Str" + this + "String_Node_Str"+ this.query);
  }
  if (qb.getParseInfo().getWhrForClause(clauseName) != null) {
    this.whereAST=qb.getParseInfo().getWhrForClause(clauseName);
  }
  if (qb.getParseInfo().getGroupByForClause(clauseName) != null) {
    this.groupByAST=qb.getParseInfo().getGroupByForClause(clauseName);
  }
  if (qb.getParseInfo().getSelForClause(clauseName) != null) {
    this.selectAST=qb.getParseInfo().getSelForClause(clauseName);
  }
  if (qb.getParseInfo().getHavingForClause(clauseName) != null) {
    this.havingAST=qb.getParseInfo().getHavingForClause(clauseName);
  }
  if (qb.getParseInfo().getOrderByForClause(clauseName) != null) {
    this.orderByAST=qb.getParseInfo().getOrderByForClause(clauseName);
  }
  this.fromAST=HQLParser.findNodeByPath(ast,TOK_FROM);
}