Program: 70953
Project: 70953
Buggy source:
/** 
 * @param query
 * @param dataSet
 * @return
 * @throws DataException
 */
public static Strategy getQueryExecutionStrategy(IQueryDefinition query,IBaseDataSetDesign dataSet) throws DataException {
  if (query.getGroups() != null && query.getGroups().size() > 0)   return Strategy.Complex;
  if (query.getFilters() != null && query.getFilters().size() > 0) {
    return Strategy.Complex;
  }
  if (query.getSorts() != null && query.getSorts().size() > 0)   return Strategy.Complex;
  if (query.getSubqueries() != null && query.getSubqueries().size() > 0)   return Strategy.Complex;
  if (query.getBindings() != null) {
    Iterator bindingIt=query.getBindings().values().iterator();
    while (bindingIt.hasNext()) {
      IBinding binding=(IBinding)bindingIt.next();
      if (binding.getAggrFunction() != null)       return Strategy.Complex;
      if (ExpressionCompilerUtil.hasAggregationInExpr(binding.getExpression())) {
        return Strategy.Complex;
      }
    }
  }
  if (dataSet != null) {
    if (dataSet.getFilters() != null) {
      if (FilterUtil.hasMutipassFilters(dataSet.getFilters())) {
        return Strategy.Complex;
      }
    }
    if (dataSet.needDistinctValue())     return Strategy.Complex;
    if (dataSet.getComputedColumns() != null) {
      List computedColumns=dataSet.getComputedColumns();
      for (int i=0; i < computedColumns.size(); i++) {
        IComputedColumn computedColumn=(IComputedColumn)computedColumns.get(i);
        if (computedColumn.getAggregateFunction() != null)         return Strategy.Complex;
        if (computedColumn.getExpression() instanceof IScriptExpression) {
          if (ExpressionUtil.hasAggregation(((IScriptExpression)computedColumn.getExpression()).getText())) {
            return Strategy.Complex;
          }
        }
      }
    }
  }
  return Strategy.Simple;
}

Fixed version (ground truth):
/** 
 * @param query
 * @param dataSet
 * @return
 * @throws DataException
 */
public static Strategy getQueryExecutionStrategy(IQueryDefinition query,IBaseDataSetDesign dataSet) throws DataException {
  if (query.getGroups() != null && query.getGroups().size() > 0)   return Strategy.Complex;
  if (query.getFilters() != null && query.getFilters().size() > 0) {
    return Strategy.Complex;
  }
  if (query.getSorts() != null && query.getSorts().size() > 0)   return Strategy.Complex;
  if (query.getSubqueries() != null && query.getSubqueries().size() > 0)   return Strategy.Complex;
  if (!query.usesDetails()) {
    return Strategy.Complex;
  }
  if (query.getBindings() != null) {
    Iterator bindingIt=query.getBindings().values().iterator();
    while (bindingIt.hasNext()) {
      IBinding binding=(IBinding)bindingIt.next();
      if (binding.getAggrFunction() != null)       return Strategy.Complex;
      if (ExpressionCompilerUtil.hasAggregationInExpr(binding.getExpression())) {
        return Strategy.Complex;
      }
    }
  }
  if (dataSet != null) {
    if (dataSet.getFilters() != null) {
      if (FilterUtil.hasMutipassFilters(dataSet.getFilters())) {
        return Strategy.Complex;
      }
    }
    if (dataSet.needDistinctValue())     return Strategy.Complex;
    if (dataSet.getComputedColumns() != null) {
      List computedColumns=dataSet.getComputedColumns();
      for (int i=0; i < computedColumns.size(); i++) {
        IComputedColumn computedColumn=(IComputedColumn)computedColumns.get(i);
        if (computedColumn.getAggregateFunction() != null)         return Strategy.Complex;
        if (computedColumn.getExpression() instanceof IScriptExpression) {
          if (ExpressionUtil.hasAggregation(((IScriptExpression)computedColumn.getExpression()).getText())) {
            return Strategy.Complex;
          }
        }
      }
    }
  }
  return Strategy.Simple;
}