Program: 5905
Project: 5905
Buggy source:
@Test public void testParallelAggregators() throws Exception {
  String sink1Name="String_Node_Str";
  String sink2Name="String_Node_Str";
  Schema inputSchema=Schema.recordOf("String_Node_Str",Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.STRING)),Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.LONG)));
  List<StructuredRecord> input1=ImmutableList.of(StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",1L).build(),StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",2L).build());
  List<StructuredRecord> input2=ImmutableList.of(StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",3L).build(),StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",4L).build(),StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",3L).build());
  DataStreamsConfig pipelineConfig=DataStreamsConfig.builder().setBatchInterval("String_Node_Str").addStage(new ETLStage("String_Node_Str",MockSource.getPlugin(inputSchema,input1))).addStage(new ETLStage("String_Node_Str",MockSource.getPlugin(inputSchema,input2))).addStage(new ETLStage("String_Node_Str",MockSink.getPlugin(sink1Name))).addStage(new ETLStage("String_Node_Str",MockSink.getPlugin(sink2Name))).addStage(new ETLStage("String_Node_Str",FieldCountAggregator.getPlugin("String_Node_Str","String_Node_Str"))).addStage(new ETLStage("String_Node_Str",FieldCountAggregator.getPlugin("String_Node_Str","String_Node_Str"))).addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").build();
  AppRequest<DataStreamsConfig> appRequest=new AppRequest<>(APP_ARTIFACT,pipelineConfig);
  Id.Application appId=Id.Application.from(Id.Namespace.DEFAULT,"String_Node_Str");
  ApplicationManager appManager=deployApplication(appId,appRequest);
  SparkManager sparkManager=appManager.getSparkManager(DataStreamsSparkLauncher.NAME);
  sparkManager.start();
  sparkManager.waitForStatus(true,10,1);
  Schema outputSchema1=Schema.recordOf("String_Node_Str",Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.STRING)),Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.LONG)));
  Schema outputSchema2=Schema.recordOf("String_Node_Str",Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.LONG)),Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.LONG)));
  final DataSetManager<Table> sinkManager1=getDataset(sink1Name);
  final Set<StructuredRecord> expected1=ImmutableSet.of(StructuredRecord.builder(outputSchema1).set("String_Node_Str","String_Node_Str").set("String_Node_Str",5L).build(),StructuredRecord.builder(outputSchema1).set("String_Node_Str","String_Node_Str").set("String_Node_Str",3L).build(),StructuredRecord.builder(outputSchema1).set("String_Node_Str","String_Node_Str").set("String_Node_Str",2L).build());
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      sinkManager1.flush();
      Set<StructuredRecord> outputRecords=new HashSet<>();
      outputRecords.addAll(MockSink.readOutput(sinkManager1));
      return expected1.equals(outputRecords);
    }
  }
,1,TimeUnit.MINUTES);
  final DataSetManager<Table> sinkManager2=getDataset(sink2Name);
  final Set<StructuredRecord> expected2=ImmutableSet.of(StructuredRecord.builder(outputSchema2).set("String_Node_Str",0L).set("String_Node_Str",5L).build(),StructuredRecord.builder(outputSchema2).set("String_Node_Str",1L).set("String_Node_Str",1L).build(),StructuredRecord.builder(outputSchema2).set("String_Node_Str",2L).set("String_Node_Str",1L).build(),StructuredRecord.builder(outputSchema2).set("String_Node_Str",3L).set("String_Node_Str",2L).build(),StructuredRecord.builder(outputSchema2).set("String_Node_Str",4L).set("String_Node_Str",1L).build());
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      sinkManager2.flush();
      Set<StructuredRecord> outputRecords=new HashSet<>();
      outputRecords.addAll(MockSink.readOutput(sinkManager2));
      return expected2.equals(outputRecords);
    }
  }
,1,TimeUnit.MINUTES);
  sparkManager.stop();
  sparkManager.waitForStatus(false,10,1);
}

Fixed version (ground truth):
@Test public void testParallelAggregators() throws Exception {
  String sink1Name="String_Node_Str";
  String sink2Name="String_Node_Str";
  Schema inputSchema=Schema.recordOf("String_Node_Str",Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.STRING)),Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.LONG)));
  List<StructuredRecord> input1=ImmutableList.of(StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",1L).build(),StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",2L).build());
  List<StructuredRecord> input2=ImmutableList.of(StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",3L).build(),StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",4L).build(),StructuredRecord.builder(inputSchema).set("String_Node_Str","String_Node_Str").set("String_Node_Str",3L).build());
  DataStreamsConfig pipelineConfig=DataStreamsConfig.builder().setBatchInterval("String_Node_Str").addStage(new ETLStage("String_Node_Str",MockSource.getPlugin(inputSchema,input1))).addStage(new ETLStage("String_Node_Str",MockSource.getPlugin(inputSchema,input2))).addStage(new ETLStage("String_Node_Str",MockSink.getPlugin(sink1Name))).addStage(new ETLStage("String_Node_Str",MockSink.getPlugin(sink2Name))).addStage(new ETLStage("String_Node_Str",FieldCountAggregator.getPlugin("String_Node_Str","String_Node_Str"))).addStage(new ETLStage("String_Node_Str",FieldCountAggregator.getPlugin("String_Node_Str","String_Node_Str"))).addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").addConnection("String_Node_Str","String_Node_Str").build();
  AppRequest<DataStreamsConfig> appRequest=new AppRequest<>(APP_ARTIFACT,pipelineConfig);
  Id.Application appId=Id.Application.from(Id.Namespace.DEFAULT,"String_Node_Str");
  ApplicationManager appManager=deployApplication(appId,appRequest);
  SparkManager sparkManager=appManager.getSparkManager(DataStreamsSparkLauncher.NAME);
  sparkManager.start();
  sparkManager.waitForStatus(true,10,1);
  Schema outputSchema1=Schema.recordOf("String_Node_Str",Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.STRING)),Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.LONG)));
  Schema outputSchema2=Schema.recordOf("String_Node_Str",Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.LONG)),Schema.Field.of("String_Node_Str",Schema.of(Schema.Type.LONG)));
  final DataSetManager<Table> sinkManager1=getDataset(sink1Name);
  final Set<StructuredRecord> expected1=ImmutableSet.of(StructuredRecord.builder(outputSchema1).set("String_Node_Str","String_Node_Str").set("String_Node_Str",5L).build(),StructuredRecord.builder(outputSchema1).set("String_Node_Str","String_Node_Str").set("String_Node_Str",3L).build(),StructuredRecord.builder(outputSchema1).set("String_Node_Str","String_Node_Str").set("String_Node_Str",2L).build());
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      sinkManager1.flush();
      Set<StructuredRecord> outputRecords=new HashSet<>();
      outputRecords.addAll(MockSink.readOutput(sinkManager1));
      return expected1.equals(outputRecords);
    }
  }
,1,TimeUnit.MINUTES);
  final DataSetManager<Table> sinkManager2=getDataset(sink2Name);
  final Set<StructuredRecord> expected2=ImmutableSet.of(StructuredRecord.builder(outputSchema2).set("String_Node_Str",0L).set("String_Node_Str",5L).build(),StructuredRecord.builder(outputSchema2).set("String_Node_Str",1L).set("String_Node_Str",1L).build(),StructuredRecord.builder(outputSchema2).set("String_Node_Str",2L).set("String_Node_Str",1L).build(),StructuredRecord.builder(outputSchema2).set("String_Node_Str",3L).set("String_Node_Str",2L).build(),StructuredRecord.builder(outputSchema2).set("String_Node_Str",4L).set("String_Node_Str",1L).build());
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      sinkManager2.flush();
      Set<StructuredRecord> outputRecords=new HashSet<>();
      outputRecords.addAll(MockSink.readOutput(sinkManager2));
      return expected2.equals(outputRecords);
    }
  }
,1,TimeUnit.MINUTES);
  sparkManager.stop();
  sparkManager.waitForStatus(false,10,1);
  validateMetric(appId,"String_Node_Str",2);
  validateMetric(appId,"String_Node_Str",3);
  validateMetric(appId,"String_Node_Str",5);
  validateMetric(appId,"String_Node_Str",3);
  validateMetric(appId,"String_Node_Str",5);
  validateMetric(appId,"String_Node_Str",5);
  validateMetric(appId,"String_Node_Str",3);
  validateMetric(appId,"String_Node_Str",5);
}