Program: 140129
Project: 140129
Buggy source:
/** 
 * DOC scorreia Comment method "instantiateQuery".
 * @param indicator
 */
private void instantiateQuery(Indicator indicator){
  if (ColumnsetPackage.eINSTANCE.getColumnSetMultiValueIndicator().isSuperTypeOf(indicator.eClass())) {
    ColumnSetMultiValueIndicator colSetMultValIndicator=(ColumnSetMultiValueIndicator)indicator;
    final EList<Column> analyzedColumns=colSetMultValIndicator.getAnalyzedColumns();
    final EList<String> numericFunctions=initializeNumericFunctions(colSetMultValIndicator);
    final EList<String> dateFunctions=initializeDateFunctions(colSetMultValIndicator);
    List<String> nominalColumns=new ArrayList<String>();
    for (    Column column : colSetMultValIndicator.getNominalColumns()) {
      nominalColumns.add(column.getName());
    }
    List<String> computedColumns=new ArrayList<String>();
    for (    Column column : colSetMultValIndicator.getNumericColumns()) {
      for (      String f : numericFunctions) {
        computedColumns.add(replaceVariablesLow(f,column.getName()));
      }
    }
    for (    Column column : colSetMultValIndicator.getDateColumns()) {
      for (      String f : numericFunctions) {
        computedColumns.add(replaceVariablesLow(f,column.getName()));
      }
    }
    computedColumns.add(colSetMultValIndicator.getCountAll());
    String selectItems=createSelect(nominalColumns,computedColumns);
    final Expression sqlGenericExpression=dbms().getSqlExpression(indicator.getIndicatorDefinition());
    String grpByClause=createGroupBy(nominalColumns);
    String tableName=getTableName(analyzedColumns);
    String sqlExpr=dbms().fillGenericQueryWithColumnTableAndAlias(sqlGenericExpression.getBody(),selectItems,tableName,grpByClause);
    String stringDataFilter=AnalysisHelper.getStringDataFilter(cachedAnalysis);
    if (stringDataFilter == null) {
      stringDataFilter="String_Node_Str";
    }
    sqlExpr=dbms().addWhereToStatement(sqlExpr,stringDataFilter);
    indicator.setInstantiatedExpression(BooleanExpressionHelper.createExpression(sqlGenericExpression.getLanguage(),sqlExpr));
  }
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "instantiateQuery".
 * @param indicator
 */
private void instantiateQuery(Indicator indicator){
  if (ColumnsetPackage.eINSTANCE.getColumnSetMultiValueIndicator().isSuperTypeOf(indicator.eClass())) {
    ColumnSetMultiValueIndicator colSetMultValIndicator=(ColumnSetMultiValueIndicator)indicator;
    final EList<Column> analyzedColumns=colSetMultValIndicator.getAnalyzedColumns();
    final EList<String> numericFunctions=initializeNumericFunctions(colSetMultValIndicator);
    final EList<String> dateFunctions=initializeDateFunctions(colSetMultValIndicator);
    List<String> nominalColumns=new ArrayList<String>();
    for (    Column column : colSetMultValIndicator.getNominalColumns()) {
      nominalColumns.add(column.getName());
    }
    List<String> computedColumns=new ArrayList<String>();
    for (    Column column : colSetMultValIndicator.getNumericColumns()) {
      for (      String f : numericFunctions) {
        computedColumns.add(replaceVariablesLow(f,column.getName()));
      }
    }
    for (    Column column : colSetMultValIndicator.getDateColumns()) {
      for (      String f : dateFunctions) {
        computedColumns.add(replaceVariablesLow(f,column.getName()));
      }
    }
    computedColumns.add(colSetMultValIndicator.getCountAll());
    String selectItems=createSelect(nominalColumns,computedColumns);
    final Expression sqlGenericExpression=dbms().getSqlExpression(indicator.getIndicatorDefinition());
    String grpByClause=createGroupBy(nominalColumns);
    String tableName=getTableName(analyzedColumns);
    String sqlExpr=dbms().fillGenericQueryWithColumnTableAndAlias(sqlGenericExpression.getBody(),selectItems,tableName,grpByClause);
    String stringDataFilter=AnalysisHelper.getStringDataFilter(cachedAnalysis);
    if (stringDataFilter == null) {
      stringDataFilter="String_Node_Str";
    }
    sqlExpr=dbms().addWhereToStatement(sqlExpr,stringDataFilter);
    indicator.setInstantiatedExpression(BooleanExpressionHelper.createExpression(sqlGenericExpression.getLanguage(),sqlExpr));
  }
}