Program: 167027
Project: 167027
Buggy source:
void addEdge(boolean streaming,SqlgEdge sqlgEdge,SqlgVertex outVertex,SqlgVertex inVertex,Map<String,Object> keyValueMap){
  SchemaTable outSchemaTable=SchemaTable.of(outVertex.getSchema(),sqlgEdge.getTable());
  if (!streaming) {
    Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> triples=this.edgeCache.get(outSchemaTable);
    if (triples == null) {
      triples=Pair.of(new TreeSet<>(keyValueMap.keySet()),new LinkedHashMap<>());
      triples.getRight().put(sqlgEdge,Triple.of(outVertex,inVertex,keyValueMap));
      this.edgeCache.put(outSchemaTable,triples);
    }
 else {
      triples.getLeft().addAll(keyValueMap.keySet());
      triples.getRight().put(sqlgEdge,Triple.of(outVertex,inVertex,keyValueMap));
    }
    Map<SchemaTable,List<SqlgEdge>> outEdgesMap=this.vertexOutEdgeCache.get(outVertex);
    if (outEdgesMap == null) {
      outEdgesMap=new HashMap<>();
      List<SqlgEdge> edges=new ArrayList<>();
      edges.add(sqlgEdge);
      outEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      this.vertexOutEdgeCache.put(outVertex,outEdgesMap);
    }
 else {
      List<SqlgEdge> sqlgEdges=outEdgesMap.get(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()));
      if (sqlgEdges == null) {
        List<SqlgEdge> edges=new ArrayList<>();
        edges.add(sqlgEdge);
        outEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      }
 else {
        sqlgEdges.add(sqlgEdge);
      }
    }
    Map<SchemaTable,List<SqlgEdge>> inEdgesMap=this.vertexInEdgeCache.get(outVertex);
    if (inEdgesMap == null) {
      inEdgesMap=new HashMap<>();
      List<SqlgEdge> edges=new ArrayList<>();
      edges.add(sqlgEdge);
      inEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      this.vertexInEdgeCache.put(inVertex,inEdgesMap);
    }
 else {
      List<SqlgEdge> sqlgEdges=inEdgesMap.get(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()));
      if (sqlgEdges == null) {
        List<SqlgEdge> edges=new ArrayList<>();
        edges.add(sqlgEdge);
        inEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      }
 else {
        sqlgEdges.add(sqlgEdge);
      }
    }
  }
 else {
    if (this.streamingBatchModeEdgeSchemaTable == null) {
      this.streamingBatchModeEdgeSchemaTable=sqlgEdge.getSchemaTablePrefixed();
    }
    if (this.streamingBatchModeEdgeKeys == null) {
      this.streamingBatchModeEdgeKeys=new ArrayList<>(keyValueMap.keySet());
    }
    if (this.isStreamingVertices()) {
      throw new IllegalStateException("String_Node_Str");
    }
    if (this.isInStreamingModeWithLock() && this.batchCount == 0) {
      this.sqlDialect.lockTable(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
      this.batchIndex=this.sqlDialect.nextSequenceVal(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
    }
    if (this.isInStreamingModeWithLock()) {
      sqlgEdge.setInternalPrimaryKey(RecordId.from(outSchemaTable,++this.batchIndex));
    }
    OutputStream out=this.streamingEdgeOutputStreamCache.get(outSchemaTable);
    if (out == null) {
      String sql=this.sqlDialect.constructCompleteCopyCommandSqlEdge(sqlgGraph,sqlgEdge,outVertex,inVertex,keyValueMap);
      out=this.sqlDialect.streamSql(this.sqlgGraph,sql);
      this.streamingEdgeOutputStreamCache.put(outSchemaTable,out);
    }
    try {
      this.sqlDialect.writeStreamingEdge(out,sqlgEdge,outVertex,inVertex,keyValueMap);
      if (this.isInStreamingModeWithLock()) {
        this.batchCount++;
      }
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
void addEdge(boolean streaming,SqlgEdge sqlgEdge,SqlgVertex outVertex,SqlgVertex inVertex,Map<String,Object> keyValueMap){
  SchemaTable outSchemaTable=SchemaTable.of(outVertex.getSchema(),sqlgEdge.getTable());
  MetaEdge metaEdge=MetaEdge.from(outSchemaTable,outVertex,inVertex);
  if (!streaming) {
    Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> triples=this.edgeCache.get(metaEdge);
    if (triples == null) {
      triples=Pair.of(new TreeSet<>(keyValueMap.keySet()),new LinkedHashMap<>());
      triples.getRight().put(sqlgEdge,Triple.of(outVertex,inVertex,keyValueMap));
      this.edgeCache.put(metaEdge,triples);
    }
 else {
      triples.getLeft().addAll(keyValueMap.keySet());
      triples.getRight().put(sqlgEdge,Triple.of(outVertex,inVertex,keyValueMap));
    }
  }
 else {
    if (this.streamingBatchModeEdgeSchemaTable == null) {
      this.streamingBatchModeEdgeSchemaTable=sqlgEdge.getSchemaTablePrefixed();
    }
    if (this.streamingBatchModeEdgeKeys == null) {
      this.streamingBatchModeEdgeKeys=new ArrayList<>(keyValueMap.keySet());
    }
    if (this.isStreamingVertices()) {
      throw new IllegalStateException("String_Node_Str");
    }
    if (this.isInStreamingModeWithLock() && this.batchCount == 0) {
      this.sqlDialect.lockTable(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
      this.batchIndex=this.sqlDialect.nextSequenceVal(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
    }
    if (this.isInStreamingModeWithLock()) {
      sqlgEdge.setInternalPrimaryKey(RecordId.from(outSchemaTable,++this.batchIndex));
    }
    OutputStream out=this.streamingEdgeOutputStreamCache.get(outSchemaTable);
    if (out == null) {
      String sql=this.sqlDialect.constructCompleteCopyCommandSqlEdge(sqlgGraph,sqlgEdge,outVertex,inVertex,keyValueMap);
      out=this.sqlDialect.streamSql(this.sqlgGraph,sql);
      this.streamingEdgeOutputStreamCache.put(outSchemaTable,out);
    }
    try {
      this.sqlDialect.writeStreamingEdge(out,sqlgEdge,outVertex,inVertex,keyValueMap);
      if (this.isInStreamingModeWithLock()) {
        this.batchCount++;
      }
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
  }
}