Program: 17361
Project: 17361
Buggy source:
/** 
 * Iterates through cql statements executing them in sequence and mapping the results until limit is reached
 * @param statementIterator Statement iterator to execute
 * @param definition definition to execute the statements against
 * @return Ordered resultset concatenating results from statements in statement iterator.
 */
private List<Map<String,Object>> mapResults(CQLStatementIterator statementIterator,CDefinition definition,Long limit) throws RhombusException {
  List<Map<String,Object>> results=Lists.newArrayList();
  int statementNumber=0;
  int resultNumber=0;
  Map<String,Object> clientFilters=statementIterator.getClientFilters();
  CQLExecutorIterator cqlIterator=new CQLExecutorIterator(cqlExecutor,(BaseCQLStatementIterator)statementIterator);
  long nonMatching=0;
  long matching=0;
  while (cqlIterator.hasNext()) {
    Row row=cqlIterator.next();
    if (row == null) {
      continue;
    }
    Map<String,Object> result=mapResult(row,definition);
    boolean resultMatchesFilters=true;
    if (clientFilters != null) {
      resultMatchesFilters=this.resultMatchesFilters(result,clientFilters);
    }
    if (resultMatchesFilters) {
      results.add(result);
      resultNumber++;
      matching++;
    }
 else {
      nonMatching++;
    }
    logger.debug("String_Node_Str",matching,nonMatching);
    if ((limit > 0 && resultNumber >= limit)) {
      logger.debug("String_Node_Str");
      break;
    }
    if (cqlIterator.statementNumber > reasonableStatementLimit) {
      throw new RhombusException("String_Node_Str" + reasonableStatementLimit + "String_Node_Str");
    }
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Iterates through cql statements executing them in sequence and mapping the results until limit is reached
 * @param statementIterator Statement iterator to execute
 * @param definition definition to execute the statements against
 * @return Ordered resultset concatenating results from statements in statement iterator.
 */
private List<Map<String,Object>> mapResults(CQLStatementIterator statementIterator,CDefinition definition,Long limit) throws RhombusException {
  List<Map<String,Object>> results=Lists.newArrayList();
  int statementNumber=0;
  int resultNumber=0;
  Map<String,Object> clientFilters=statementIterator.getClientFilters();
  CQLExecutorIterator cqlIterator=new CQLExecutorIterator(cqlExecutor,(BaseCQLStatementIterator)statementIterator);
  cqlIterator.setPageSize(limit);
  long nonMatching=0;
  long matching=0;
  while (cqlIterator.hasNext()) {
    Row row=cqlIterator.next();
    if (row == null) {
      continue;
    }
    Map<String,Object> result=mapResult(row,definition);
    boolean resultMatchesFilters=true;
    if (clientFilters != null) {
      resultMatchesFilters=this.resultMatchesFilters(result,clientFilters);
    }
    if (resultMatchesFilters) {
      results.add(result);
      resultNumber++;
      matching++;
    }
 else {
      nonMatching++;
    }
    logger.debug("String_Node_Str",matching,nonMatching);
    if ((limit > 0 && resultNumber >= limit)) {
      logger.debug("String_Node_Str");
      break;
    }
    if (cqlIterator.statementNumber > reasonableStatementLimit) {
      throw new RhombusException("String_Node_Str" + reasonableStatementLimit + "String_Node_Str");
    }
  }
  return results;
}