Program: 28757
Project: 28757
Buggy source:
/** 
 * Parse Selector portion of a query and return corresponding QuerySelector
 * @param selector                    selector to be parsed
 * @param outputStream                output stream
 * @param siddhiAppContext            query to be parsed
 * @param metaComplexEvent            Meta event used to collect execution info of stream associated with query
 * @param tableMap                    Table Map
 * @param variableExpressionExecutors variable expression executors
 * @param queryName                   query name of selector belongs to.
 * @return QuerySelector
 */
public static QuerySelector parse(Selector selector,OutputStream outputStream,SiddhiAppContext siddhiAppContext,MetaComplexEvent metaComplexEvent,Map<String,Table> tableMap,List<VariableExpressionExecutor> variableExpressionExecutors,String queryName){
  boolean currentOn=false;
  boolean expiredOn=false;
  String id=null;
  if (outputStream.getOutputEventType() == OutputStream.OutputEventType.CURRENT_EVENTS || outputStream.getOutputEventType() == OutputStream.OutputEventType.ALL_EVENTS) {
    currentOn=true;
  }
  if (outputStream.getOutputEventType() == OutputStream.OutputEventType.EXPIRED_EVENTS || outputStream.getOutputEventType() == OutputStream.OutputEventType.ALL_EVENTS) {
    expiredOn=true;
  }
  id=outputStream.getId();
  containsAggregatorThreadLocal.remove();
  QuerySelector querySelector=new QuerySelector(id,selector,currentOn,expiredOn,siddhiAppContext);
  List<AttributeProcessor> attributeProcessors=getAttributeProcessors(selector,id,siddhiAppContext,metaComplexEvent,tableMap,variableExpressionExecutors,outputStream,queryName);
  querySelector.setAttributeProcessorList(attributeProcessors,"String_Node_Str".equals(containsAggregatorThreadLocal.get()));
  containsAggregatorThreadLocal.remove();
  ConditionExpressionExecutor havingCondition=generateHavingExecutor(selector.getHavingExpression(),metaComplexEvent,siddhiAppContext,tableMap,variableExpressionExecutors,queryName);
  querySelector.setHavingConditionExecutor(havingCondition,"String_Node_Str".equals(containsAggregatorThreadLocal.get()));
  containsAggregatorThreadLocal.remove();
  if (!selector.getGroupByList().isEmpty()) {
    querySelector.setGroupByKeyGenerator(new GroupByKeyGenerator(selector.getGroupByList(),metaComplexEvent,null,variableExpressionExecutors,siddhiAppContext,queryName));
  }
  return querySelector;
}

Fixed version (ground truth):
/** 
 * Parse Selector portion of a query and return corresponding QuerySelector.
 * @param selector                    selector to be parsed
 * @param outputStream                output stream
 * @param siddhiAppContext            query to be parsed
 * @param metaComplexEvent            Meta event used to collect execution info of stream associated with query
 * @param tableMap                    Table Map
 * @param variableExpressionExecutors variable expression executors
 * @param queryName                   query name of selector belongs to.
 * @return QuerySelector
 */
public static QuerySelector parse(Selector selector,OutputStream outputStream,SiddhiAppContext siddhiAppContext,MetaComplexEvent metaComplexEvent,Map<String,Table> tableMap,List<VariableExpressionExecutor> variableExpressionExecutors,String queryName,int metaPosition){
  boolean currentOn=false;
  boolean expiredOn=false;
  String id=null;
  if (outputStream.getOutputEventType() == OutputStream.OutputEventType.CURRENT_EVENTS || outputStream.getOutputEventType() == OutputStream.OutputEventType.ALL_EVENTS) {
    currentOn=true;
  }
  if (outputStream.getOutputEventType() == OutputStream.OutputEventType.EXPIRED_EVENTS || outputStream.getOutputEventType() == OutputStream.OutputEventType.ALL_EVENTS) {
    expiredOn=true;
  }
  id=outputStream.getId();
  containsAggregatorThreadLocal.remove();
  QuerySelector querySelector=new QuerySelector(id,selector,currentOn,expiredOn,siddhiAppContext);
  List<AttributeProcessor> attributeProcessors=getAttributeProcessors(selector,id,siddhiAppContext,metaComplexEvent,tableMap,variableExpressionExecutors,outputStream,queryName,metaPosition);
  querySelector.setAttributeProcessorList(attributeProcessors,"String_Node_Str".equals(containsAggregatorThreadLocal.get()));
  containsAggregatorThreadLocal.remove();
  ConditionExpressionExecutor havingCondition=generateHavingExecutor(selector.getHavingExpression(),metaComplexEvent,siddhiAppContext,tableMap,variableExpressionExecutors,queryName);
  querySelector.setHavingConditionExecutor(havingCondition,"String_Node_Str".equals(containsAggregatorThreadLocal.get()));
  containsAggregatorThreadLocal.remove();
  if (!selector.getGroupByList().isEmpty()) {
    querySelector.setGroupByKeyGenerator(new GroupByKeyGenerator(selector.getGroupByList(),metaComplexEvent,null,variableExpressionExecutors,siddhiAppContext,queryName));
  }
  return querySelector;
}