Program: 166958
Project: 166958
Buggy source:
private String bulkWithJoin(SqlgGraph sqlgGraph){
  StringBuilder sb=new StringBuilder();
  List<HasContainer> bulkHasContainers=this.hasContainers.stream().filter(h -> SqlgUtil.isBulkWithinAndOut(sqlgGraph,h)).collect(Collectors.toList());
  for (  HasContainer hasContainer : bulkHasContainers) {
    P<List<Object>> predicate=(P<List<Object>>)hasContainer.getPredicate();
    Collection<Object> withInList=predicate.getValue();
    Set<Object> withInOuts=new HashSet<>(withInList);
    Map<String,PropertyType> columns=new HashMap<>();
    Object next=withInOuts.iterator().next();
    if (next instanceof RecordId) {
      next=((RecordId)next).getId();
    }
    if (hasContainer.getBiPredicate() == Contains.within) {
      columns.put(WITHIN,PropertyType.from(next));
    }
 else     if (hasContainer.getBiPredicate() == Contains.without) {
      columns.put(WITHOUT,PropertyType.from(next));
    }
 else {
      throw new UnsupportedOperationException("String_Node_Str");
    }
    SecureRandom random=new SecureRandom();
    byte bytes[]=new byte[6];
    random.nextBytes(bytes);
    String tmpTableIdentified=Base64.getEncoder().encodeToString(bytes);
    tmpTableIdentified=SchemaManager.VERTEX_PREFIX + SchemaManager.BULK_TEMP_EDGE + tmpTableIdentified;
    sqlgGraph.getTopology().createTempTable(tmpTableIdentified,columns);
    Map<String,Object> withInOutMap=new HashMap<>();
    if (hasContainer.getBiPredicate() == Contains.within) {
      withInOutMap.put(WITHIN,"String_Node_Str");
    }
 else {
      withInOutMap.put(WITHOUT,"String_Node_Str");
    }
    String copySql=((SqlBulkDialect)sqlgGraph.getSqlDialect()).temporaryTableCopyCommandSqlVertex(sqlgGraph,SchemaTable.of("String_Node_Str",tmpTableIdentified.substring(SchemaManager.VERTEX_PREFIX.length())),withInOutMap.keySet());
    Writer writer=((SqlBulkDialect)sqlgGraph.getSqlDialect()).streamSql(this.sqlgGraph,copySql);
    for (    Object withInOutValue : withInOuts) {
      if (withInOutValue instanceof RecordId) {
        withInOutValue=((RecordId)withInOutValue).getId();
      }
      withInOutMap=new HashMap<>();
      if (hasContainer.getBiPredicate() == Contains.within) {
        withInOutMap.put(WITHIN,withInOutValue);
      }
 else {
        withInOutMap.put(WITHOUT,withInOutValue);
      }
      ((SqlBulkDialect)sqlgGraph.getSqlDialect()).writeStreamingVertex(writer,withInOutMap);
    }
    try {
      writer.close();
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
    if (hasContainer.getBiPredicate() == Contains.within) {
      sb.append("String_Node_Str");
    }
 else {
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str");
    sb.append(tmpTableIdentified);
    sb.append("String_Node_Str");
    sb.append(this.rootSchemaTableTree().tmpTableAliasCounter);
    sb.append("String_Node_Str");
    sb.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getSchemaTable().getSchema()));
    sb.append("String_Node_Str");
    sb.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getSchemaTable().getTable()));
    sb.append("String_Node_Str");
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      sb.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
    }
 else {
      sb.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey()));
    }
    if (hasContainer.getBiPredicate() == Contains.within) {
      sb.append("String_Node_Str");
      sb.append(this.rootSchemaTableTree().tmpTableAliasCounter++);
      sb.append("String_Node_Str");
    }
 else {
      sb.append("String_Node_Str");
      sb.append(this.rootSchemaTableTree().tmpTableAliasCounter++);
      sb.append("String_Node_Str");
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
private String bulkWithJoin(SqlgGraph sqlgGraph){
  StringBuilder sb=new StringBuilder();
  List<HasContainer> bulkHasContainers=this.hasContainers.stream().filter(h -> SqlgUtil.isBulkWithinAndOut(sqlgGraph,h)).collect(Collectors.toList());
  for (  HasContainer hasContainer : bulkHasContainers) {
    P<List<Object>> predicate=(P<List<Object>>)hasContainer.getPredicate();
    Collection<Object> withInList=predicate.getValue();
    Set<Object> withInOuts=new HashSet<>(withInList);
    Map<String,PropertyType> columns=new HashMap<>();
    Object next=withInOuts.iterator().next();
    if (next instanceof RecordId) {
      next=((RecordId)next).getId();
    }
    if (hasContainer.getBiPredicate() == Contains.within) {
      columns.put(WITHIN,PropertyType.from(next));
    }
 else     if (hasContainer.getBiPredicate() == Contains.without) {
      columns.put(WITHOUT,PropertyType.from(next));
    }
 else {
      throw new UnsupportedOperationException("String_Node_Str");
    }
    SecureRandom random=new SecureRandom();
    byte bytes[]=new byte[6];
    random.nextBytes(bytes);
    String tmpTableIdentified=Base64.getEncoder().encodeToString(bytes);
    tmpTableIdentified=SchemaManager.VERTEX_PREFIX + SchemaManager.BULK_TEMP_EDGE + tmpTableIdentified;
    sqlgGraph.getTopology().createTempTable(tmpTableIdentified,columns);
    Map<String,Object> withInOutMap=new HashMap<>();
    if (hasContainer.getBiPredicate() == Contains.within) {
      withInOutMap.put(WITHIN,"String_Node_Str");
    }
 else {
      withInOutMap.put(WITHOUT,"String_Node_Str");
    }
    String copySql=((SqlBulkDialect)sqlgGraph.getSqlDialect()).temporaryTableCopyCommandSqlVertex(sqlgGraph,SchemaTable.of("String_Node_Str",tmpTableIdentified.substring(SchemaManager.VERTEX_PREFIX.length())),withInOutMap.keySet());
    Writer writer=((SqlBulkDialect)sqlgGraph.getSqlDialect()).streamSql(this.sqlgGraph,copySql);
    for (    Object withInOutValue : withInOuts) {
      if (withInOutValue instanceof RecordId) {
        withInOutValue=((RecordId)withInOutValue).getId();
      }
      withInOutMap=new HashMap<>();
      if (hasContainer.getBiPredicate() == Contains.within) {
        withInOutMap.put(WITHIN,withInOutValue);
      }
 else {
        withInOutMap.put(WITHOUT,withInOutValue);
      }
      ((SqlBulkDialect)sqlgGraph.getSqlDialect()).writeStreamingVertex(writer,withInOutMap);
    }
    try {
      writer.close();
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
    if (hasContainer.getBiPredicate() == Contains.within) {
      sb.append("String_Node_Str");
    }
 else {
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str");
    sb.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(tmpTableIdentified));
    sb.append("String_Node_Str");
    sb.append(this.rootSchemaTableTree().tmpTableAliasCounter);
    sb.append("String_Node_Str");
    sb.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getSchemaTable().getSchema()));
    sb.append("String_Node_Str");
    sb.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getSchemaTable().getTable()));
    sb.append("String_Node_Str");
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      sb.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
    }
 else {
      sb.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey()));
    }
    if (hasContainer.getBiPredicate() == Contains.within) {
      sb.append("String_Node_Str");
      sb.append(this.rootSchemaTableTree().tmpTableAliasCounter++);
      sb.append("String_Node_Str");
    }
 else {
      sb.append("String_Node_Str");
      sb.append(this.rootSchemaTableTree().tmpTableAliasCounter++);
      sb.append("String_Node_Str");
    }
  }
  return sb.toString();
}