Program: 67020
Project: 67020
Buggy source:
private void testMaxAggregation(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  Dimension[] dimensions=new Dimension[3];
  String[] levelNames=new String[3];
  levelNames[0]="String_Node_Str";
  levelNames[1]="String_Node_Str";
  levelNames[2]="String_Node_Str";
  DimensionForTest iterator=new DimensionForTest(levelNames);
  iterator.setLevelMember(0,FactTable2.L1Col);
  iterator.setLevelMember(1,FactTable2.L2Col);
  iterator.setLevelMember(2,FactTable2.L3Col);
  ILevelDefn[] levelDefs=new ILevelDefn[3];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[1]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[2]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[0]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false,new StopSign());
  IHierarchy hierarchy=dimensions[0].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[0].length(),FactTable2.L3Col.length);
  levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  iterator=new DimensionForTest(levelNames);
  iterator.setLevelMember(0,distinct(FactTable2.L1Col));
  levelDefs=new ILevelDefn[1];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[1]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false,new StopSign());
  hierarchy=dimensions[1].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[1].length(),3);
  levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  iterator=new DimensionForTest(levelNames);
  iterator.setLevelMember(0,FactTable2.L3Col);
  levelDefs=new ILevelDefn[1];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[2]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false,new StopSign());
  hierarchy=dimensions[2].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[2].length(),12);
  FactTable2 factTable2=new FactTable2();
  String[] measureColumnName=new String[2];
  measureColumnName[0]="String_Node_Str";
  measureColumnName[1]="String_Node_Str";
  FactTableAccessor factTableConstructor=new FactTableAccessor(documentManager);
  FactTable factTable=factTableConstructor.saveFactTable(NamingUtil.getFactTableName("String_Node_Str"),CubeUtility.getKeyColNames(dimensions),CubeUtility.getKeyColNames(dimensions),factTable2,dimensions,measureColumnName,new StopSign(),false);
  factTable=factTableConstructor.load(NamingUtil.getFactTableName("String_Node_Str"),new StopSign());
  String[] dimensionNames=new String[3];
  dimensionNames[0]="String_Node_Str";
  dimensionNames[1]="String_Node_Str";
  dimensionNames[2]="String_Node_Str";
  DimensionResultIterator[] dimesionResultSets=new DimensionResultIterator[1];
  IDiskArray positionArray=dimensions[0].findAll();
  dimesionResultSets[0]=new DimensionResultIterator(dimensions[0],positionArray,new StopSign());
  String[] dimensionNamesForFilter=new String[1];
  dimensionNamesForFilter[0]="String_Node_Str";
  IDiskArray[] positionsForFilter=new IDiskArray[1];
  positionsForFilter[0]=positionArray;
  FactTableRowIterator facttableRowIterator=new FactTableRowIterator(factTable,dimensionNamesForFilter,positionsForFilter,new StopSign());
  assertTrue(facttableRowIterator != null);
  AggregationDefinition[] aggregations=new AggregationDefinition[1];
  AggregationFunctionDefinition[] funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str","String_Node_Str",IBuildInAggregation.TOTAL_MAX_FUNC);
  aggregations[0]=new AggregationDefinition(null,null,funcitons);
  IDataSet4Aggregation dataSet4Aggregation=new DataSetFromOriginalCube(facttableRowIterator,dimesionResultSets,null);
  AggregationExecutor aggregationCalculatorExecutor=new AggregationExecutor(null,dataSet4Aggregation,aggregations);
  IAggregationResultSet[] resultSet=aggregationCalculatorExecutor.execute(new StopSign());
  assertEquals(resultSet[0].length(),1);
  resultSet[0].seek(0);
  assertEquals(resultSet[0].getAggregationValue(0),11);
  closeResultSets(resultSet);
}

Fixed version (ground truth):
private void testMaxAggregation(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  Dimension[] dimensions=new Dimension[3];
  String[] levelNames=new String[3];
  levelNames[0]="String_Node_Str";
  levelNames[1]="String_Node_Str";
  levelNames[2]="String_Node_Str";
  DimensionForTest iterator=new DimensionForTest(levelNames);
  iterator.setLevelMember(0,FactTable2.L1Col);
  iterator.setLevelMember(1,FactTable2.L2Col);
  iterator.setLevelMember(2,FactTable2.L3Col);
  ILevelDefn[] levelDefs=new ILevelDefn[3];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[1]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[2]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[0]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false,new StopSign());
  IHierarchy hierarchy=dimensions[0].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[0].length(),FactTable2.L3Col.length);
  levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  iterator=new DimensionForTest(levelNames);
  iterator.setLevelMember(0,distinct(FactTable2.L1Col));
  levelDefs=new ILevelDefn[1];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[1]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false,new StopSign());
  hierarchy=dimensions[1].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[1].length(),3);
  levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  iterator=new DimensionForTest(levelNames);
  iterator.setLevelMember(0,FactTable2.L3Col);
  levelDefs=new ILevelDefn[1];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[2]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false,new StopSign());
  hierarchy=dimensions[2].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[2].length(),12);
  FactTable2 factTable2=new FactTable2();
  String[] measureColumnName=new String[2];
  measureColumnName[0]="String_Node_Str";
  measureColumnName[1]="String_Node_Str";
  FactTableAccessor factTableConstructor=new FactTableAccessor(documentManager);
  FactTable factTable=factTableConstructor.saveFactTable(NamingUtil.getFactTableName("String_Node_Str"),CubeUtility.getKeyColNames(dimensions),CubeUtility.getKeyColNames(dimensions),factTable2,dimensions,measureColumnName,new StopSign());
  factTable=factTableConstructor.load(NamingUtil.getFactTableName("String_Node_Str"),new StopSign());
  String[] dimensionNames=new String[3];
  dimensionNames[0]="String_Node_Str";
  dimensionNames[1]="String_Node_Str";
  dimensionNames[2]="String_Node_Str";
  DimensionResultIterator[] dimesionResultSets=new DimensionResultIterator[1];
  IDiskArray positionArray=dimensions[0].findAll();
  dimesionResultSets[0]=new DimensionResultIterator(dimensions[0],positionArray,new StopSign());
  String[] dimensionNamesForFilter=new String[1];
  dimensionNamesForFilter[0]="String_Node_Str";
  IDiskArray[] positionsForFilter=new IDiskArray[1];
  positionsForFilter[0]=positionArray;
  FactTableRowIterator facttableRowIterator=new FactTableRowIterator(factTable,dimensionNamesForFilter,positionsForFilter,new StopSign());
  assertTrue(facttableRowIterator != null);
  AggregationDefinition[] aggregations=new AggregationDefinition[1];
  AggregationFunctionDefinition[] funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str","String_Node_Str",IBuildInAggregation.TOTAL_MAX_FUNC);
  aggregations[0]=new AggregationDefinition(null,null,funcitons);
  IDataSet4Aggregation dataSet4Aggregation=new DataSetFromOriginalCube(facttableRowIterator,dimesionResultSets,null);
  AggregationExecutor aggregationCalculatorExecutor=new AggregationExecutor(null,dataSet4Aggregation,aggregations);
  IAggregationResultSet[] resultSet=aggregationCalculatorExecutor.execute(new StopSign());
  assertEquals(resultSet[0].length(),1);
  resultSet[0].seek(0);
  assertEquals(resultSet[0].getAggregationValue(0),11);
  closeResultSets(resultSet);
}