Program: 39790
Project: 39790
Buggy source:
static Pipeline buildPipeline(DwcaMiniPipelineOptions options){
  LOG.info("String_Node_Str");
  Pipeline pipeline=Pipeline.create(options);
  Coders.registerAvroCoders(pipeline,ExtendedRecord.class);
  LOG.info("String_Node_Str");
  PCollection<ExtendedRecord> rawRecords=pipeline.apply("String_Node_Str",DwCAIO.Read.withPaths(options.getInputPath(),OutputWriter.getTempDir(options)));
  LOG.info("String_Node_Str");
  UniqueOccurrenceIdTransform uniquenessTransform=UniqueOccurrenceIdTransform.create().withAvroCoders(pipeline);
  PCollectionTuple uniqueTuple=rawRecords.apply(uniquenessTransform);
  PCollection<ExtendedRecord> verbatimRecords=uniqueTuple.get(uniquenessTransform.getDataTag());
  if (DWCA_TO_AVRO == options.getPipelineStep() || !options.getIgnoreIntermediateOutputs()) {
    OutputWriter.writeToAvro(verbatimRecords,ExtendedRecord.class,options,FsUtils.buildPathString(OutputWriter.getRootPath(options),"String_Node_Str"));
  }
  if (DWCA_TO_AVRO == options.getPipelineStep()) {
    LOG.info("String_Node_Str",DWCA_TO_AVRO);
    return pipeline;
  }
  LOG.info("String_Node_Str");
  final Config wsConfig=WsConfigFactory.getConfig(options.getGbifEnv());
  LOG.info("String_Node_Str");
  TaxonRecordTransform taxonTransform=TaxonRecordTransform.create(wsConfig);
  taxonTransform.withAvroCoders(pipeline);
  PCollectionTuple taxonRecordTuple=verbatimRecords.apply("String_Node_Str",taxonTransform);
  PCollection<KV<String,TaxonRecord>> interpretedTaxonRecords=taxonRecordTuple.get(taxonTransform.getDataTag());
  OutputWriter.writeInterpretationResult(taxonRecordTuple,TaxonRecord.class,taxonTransform,options,GbifInterpretationType.TAXONOMY);
  LOG.info("String_Node_Str");
  LocationRecordTransform locationTransform=LocationRecordTransform.create(wsConfig);
  locationTransform.withAvroCoders(pipeline);
  PCollectionTuple locationRecordTuple=verbatimRecords.apply("String_Node_Str",locationTransform);
  PCollection<KV<String,LocationRecord>> interpretedLocationRecords=locationRecordTuple.get(locationTransform.getDataTag());
  OutputWriter.writeInterpretationResult(locationRecordTuple,LocationRecord.class,locationTransform,options,GbifInterpretationType.LOCATION);
  LOG.info("String_Node_Str");
  TemporalRecordTransform temporalTransform=TemporalRecordTransform.create();
  temporalTransform.withAvroCoders(pipeline);
  PCollectionTuple temporalRecordTuple=verbatimRecords.apply("String_Node_Str",temporalTransform);
  PCollection<KV<String,TemporalRecord>> interpretedTemporalRecords=temporalRecordTuple.get(temporalTransform.getDataTag());
  OutputWriter.writeInterpretationResult(temporalRecordTuple,TemporalRecord.class,temporalTransform,options,GbifInterpretationType.TEMPORAL);
  LOG.info("String_Node_Str");
  InterpretedExtendedRecordTransform interpretedRecordTransform=InterpretedExtendedRecordTransform.create();
  interpretedRecordTransform.withAvroCoders(pipeline);
  PCollectionTuple interpretedRecordTuple=verbatimRecords.apply("String_Node_Str",interpretedRecordTransform);
  PCollection<KV<String,InterpretedExtendedRecord>> interpretedRecords=interpretedRecordTuple.get(interpretedRecordTransform.getDataTag());
  OutputWriter.writeInterpretationResult(interpretedRecordTuple,InterpretedExtendedRecord.class,interpretedRecordTransform,options,GbifInterpretationType.COMMON);
  LOG.info("String_Node_Str");
  MultimediaRecordTransform multimediaTransform=MultimediaRecordTransform.create();
  multimediaTransform.withAvroCoders(pipeline);
  PCollectionTuple multimediaRecordTuple=verbatimRecords.apply("String_Node_Str",multimediaTransform);
  PCollection<KV<String,MultimediaRecord>> interpretedMultimediaRecords=multimediaRecordTuple.get(multimediaTransform.getDataTag());
  OutputWriter.writeInterpretationResult(multimediaRecordTuple,MultimediaRecord.class,multimediaTransform,options,GbifInterpretationType.MULTIMEDIA);
  if (INTERPRET == options.getPipelineStep()) {
    LOG.info("String_Node_Str",INTERPRET);
    return pipeline;
  }
  LOG.info("String_Node_Str");
  final TupleTag<ExtendedRecord> extendedRecordTag=new TupleTag<ExtendedRecord>(){
  }
;
  final TupleTag<InterpretedExtendedRecord> interRecordTag=new TupleTag<InterpretedExtendedRecord>(){
  }
;
  final TupleTag<TemporalRecord> temporalTag=new TupleTag<TemporalRecord>(){
  }
;
  final TupleTag<LocationRecord> locationTag=new TupleTag<LocationRecord>(){
  }
;
  final TupleTag<TaxonRecord> taxonomyTag=new TupleTag<TaxonRecord>(){
  }
;
  final TupleTag<MultimediaRecord> multimediaTag=new TupleTag<MultimediaRecord>(){
  }
;
  PCollection<KV<String,ExtendedRecord>> verbatimRecordsMapped=verbatimRecords.apply("String_Node_Str",MapElements.into(new TypeDescriptor<KV<String,ExtendedRecord>>(){
  }
).via((  ExtendedRecord ex) -> KV.of(ex.getId(),ex)));
  PCollection<KV<String,CoGbkResult>> groupedCollection=KeyedPCollectionTuple.of(interRecordTag,interpretedRecords).and(temporalTag,interpretedTemporalRecords).and(locationTag,interpretedLocationRecords).and(taxonomyTag,interpretedTaxonRecords).and(multimediaTag,interpretedMultimediaRecords).and(extendedRecordTag,verbatimRecordsMapped).apply(CoGroupByKey.create());
  PCollection<String> resultCollection=groupedCollection.apply("String_Node_Str",ParDo.of(new DoFn<KV<String,CoGbkResult>,String>(){
    @ProcessElement public void processElement(    ProcessContext c){
      CoGbkResult value=c.element().getValue();
      String key=c.element().getKey();
      InterpretedExtendedRecord interRecord=value.getOnly(interRecordTag,InterpretedExtendedRecord.newBuilder().setId(key).build());
      TemporalRecord temporal=value.getOnly(temporalTag,TemporalRecord.newBuilder().setId(key).build());
      LocationRecord location=value.getOnly(locationTag,LocationRecord.newBuilder().setId(key).build());
      TaxonRecord taxon=value.getOnly(taxonomyTag,TaxonRecord.newBuilder().setId(key).build());
      MultimediaRecord multimedia=value.getOnly(multimediaTag,MultimediaRecord.newBuilder().setId(key).build());
      ExtendedRecord extendedRecord=value.getOnly(extendedRecordTag,ExtendedRecord.newBuilder().setId(key).build());
      c.output(EsSchemaConverter.toIndex(interRecord,temporal,location,taxon,multimedia,extendedRecord));
    }
  }
));
  ElasticsearchIO.ConnectionConfiguration esBeamConfig=ElasticsearchIO.ConnectionConfiguration.create(options.getESHosts(),options.getESIndexName(),"String_Node_Str");
  resultCollection.apply(ElasticsearchIO.write().withConnectionConfiguration(esBeamConfig).withMaxBatchSizeBytes(options.getESMaxBatchSize()).withMaxBatchSize(options.getESMaxBatchSizeBytes()));
  return pipeline;
}

Fixed version (ground truth):
static Pipeline buildPipeline(DwcaMiniPipelineOptions options){
  LOG.info("String_Node_Str");
  Pipeline pipeline=Pipeline.create(options);
  Coders.registerAvroCoders(pipeline,ExtendedRecord.class);
  LOG.info("String_Node_Str");
  PCollection<ExtendedRecord> rawRecords=pipeline.apply("String_Node_Str",Files.isDirectory(Paths.get(options.getInputPath())) ? DwCAIO.Read.withPaths(options.getInputPath()) : DwCAIO.Read.withPaths(options.getInputPath(),OutputWriter.getTempDir(options)));
  LOG.info("String_Node_Str");
  UniqueOccurrenceIdTransform uniquenessTransform=UniqueOccurrenceIdTransform.create().withAvroCoders(pipeline);
  PCollectionTuple uniqueTuple=rawRecords.apply(uniquenessTransform);
  PCollection<ExtendedRecord> verbatimRecords=uniqueTuple.get(uniquenessTransform.getDataTag());
  if (DWCA_TO_AVRO == options.getPipelineStep() || !options.getIgnoreIntermediateOutputs()) {
    OutputWriter.writeToAvro(verbatimRecords,ExtendedRecord.class,options,FsUtils.buildPathString(OutputWriter.getRootPath(options),"String_Node_Str"));
  }
  if (DWCA_TO_AVRO == options.getPipelineStep()) {
    LOG.info("String_Node_Str",DWCA_TO_AVRO);
    return pipeline;
  }
  LOG.info("String_Node_Str");
  final Config wsConfig=WsConfigFactory.getConfig(options.getGbifEnv());
  LOG.info("String_Node_Str");
  TaxonRecordTransform taxonTransform=TaxonRecordTransform.create(wsConfig);
  taxonTransform.withAvroCoders(pipeline);
  PCollectionTuple taxonRecordTuple=verbatimRecords.apply("String_Node_Str",taxonTransform);
  PCollection<KV<String,TaxonRecord>> interpretedTaxonRecords=taxonRecordTuple.get(taxonTransform.getDataTag());
  OutputWriter.writeInterpretationResult(taxonRecordTuple,TaxonRecord.class,taxonTransform,options,GbifInterpretationType.TAXONOMY);
  LOG.info("String_Node_Str");
  LocationRecordTransform locationTransform=LocationRecordTransform.create(wsConfig);
  locationTransform.withAvroCoders(pipeline);
  PCollectionTuple locationRecordTuple=verbatimRecords.apply("String_Node_Str",locationTransform);
  PCollection<KV<String,LocationRecord>> interpretedLocationRecords=locationRecordTuple.get(locationTransform.getDataTag());
  OutputWriter.writeInterpretationResult(locationRecordTuple,LocationRecord.class,locationTransform,options,GbifInterpretationType.LOCATION);
  LOG.info("String_Node_Str");
  TemporalRecordTransform temporalTransform=TemporalRecordTransform.create();
  temporalTransform.withAvroCoders(pipeline);
  PCollectionTuple temporalRecordTuple=verbatimRecords.apply("String_Node_Str",temporalTransform);
  PCollection<KV<String,TemporalRecord>> interpretedTemporalRecords=temporalRecordTuple.get(temporalTransform.getDataTag());
  OutputWriter.writeInterpretationResult(temporalRecordTuple,TemporalRecord.class,temporalTransform,options,GbifInterpretationType.TEMPORAL);
  LOG.info("String_Node_Str");
  InterpretedExtendedRecordTransform interpretedRecordTransform=InterpretedExtendedRecordTransform.create();
  interpretedRecordTransform.withAvroCoders(pipeline);
  PCollectionTuple interpretedRecordTuple=verbatimRecords.apply("String_Node_Str",interpretedRecordTransform);
  PCollection<KV<String,InterpretedExtendedRecord>> interpretedRecords=interpretedRecordTuple.get(interpretedRecordTransform.getDataTag());
  OutputWriter.writeInterpretationResult(interpretedRecordTuple,InterpretedExtendedRecord.class,interpretedRecordTransform,options,GbifInterpretationType.COMMON);
  LOG.info("String_Node_Str");
  MultimediaRecordTransform multimediaTransform=MultimediaRecordTransform.create();
  multimediaTransform.withAvroCoders(pipeline);
  PCollectionTuple multimediaRecordTuple=verbatimRecords.apply("String_Node_Str",multimediaTransform);
  PCollection<KV<String,MultimediaRecord>> interpretedMultimediaRecords=multimediaRecordTuple.get(multimediaTransform.getDataTag());
  OutputWriter.writeInterpretationResult(multimediaRecordTuple,MultimediaRecord.class,multimediaTransform,options,GbifInterpretationType.MULTIMEDIA);
  if (INTERPRET == options.getPipelineStep()) {
    LOG.info("String_Node_Str",INTERPRET);
    return pipeline;
  }
  LOG.info("String_Node_Str");
  final TupleTag<ExtendedRecord> extendedRecordTag=new TupleTag<ExtendedRecord>(){
  }
;
  final TupleTag<InterpretedExtendedRecord> interRecordTag=new TupleTag<InterpretedExtendedRecord>(){
  }
;
  final TupleTag<TemporalRecord> temporalTag=new TupleTag<TemporalRecord>(){
  }
;
  final TupleTag<LocationRecord> locationTag=new TupleTag<LocationRecord>(){
  }
;
  final TupleTag<TaxonRecord> taxonomyTag=new TupleTag<TaxonRecord>(){
  }
;
  final TupleTag<MultimediaRecord> multimediaTag=new TupleTag<MultimediaRecord>(){
  }
;
  PCollection<KV<String,ExtendedRecord>> verbatimRecordsMapped=verbatimRecords.apply("String_Node_Str",MapElements.into(new TypeDescriptor<KV<String,ExtendedRecord>>(){
  }
).via((  ExtendedRecord ex) -> KV.of(ex.getId(),ex)));
  PCollection<KV<String,CoGbkResult>> groupedCollection=KeyedPCollectionTuple.of(interRecordTag,interpretedRecords).and(temporalTag,interpretedTemporalRecords).and(locationTag,interpretedLocationRecords).and(taxonomyTag,interpretedTaxonRecords).and(multimediaTag,interpretedMultimediaRecords).and(extendedRecordTag,verbatimRecordsMapped).apply(CoGroupByKey.create());
  PCollection<String> resultCollection=groupedCollection.apply("String_Node_Str",ParDo.of(new DoFn<KV<String,CoGbkResult>,String>(){
    @ProcessElement public void processElement(    ProcessContext c){
      CoGbkResult value=c.element().getValue();
      String key=c.element().getKey();
      InterpretedExtendedRecord interRecord=value.getOnly(interRecordTag,InterpretedExtendedRecord.newBuilder().setId(key).build());
      TemporalRecord temporal=value.getOnly(temporalTag,TemporalRecord.newBuilder().setId(key).build());
      LocationRecord location=value.getOnly(locationTag,LocationRecord.newBuilder().setId(key).build());
      TaxonRecord taxon=value.getOnly(taxonomyTag,TaxonRecord.newBuilder().setId(key).build());
      MultimediaRecord multimedia=value.getOnly(multimediaTag,MultimediaRecord.newBuilder().setId(key).build());
      ExtendedRecord extendedRecord=value.getOnly(extendedRecordTag,ExtendedRecord.newBuilder().setId(key).build());
      c.output(EsSchemaConverter.toIndex(interRecord,temporal,location,taxon,multimedia,extendedRecord));
    }
  }
));
  ElasticsearchIO.ConnectionConfiguration esBeamConfig=ElasticsearchIO.ConnectionConfiguration.create(options.getESHosts(),options.getESIndexName(),"String_Node_Str");
  resultCollection.apply(ElasticsearchIO.write().withConnectionConfiguration(esBeamConfig).withMaxBatchSizeBytes(options.getESMaxBatchSize()).withMaxBatchSize(options.getESMaxBatchSizeBytes()));
  return pipeline;
}