nus-yam/ex-repair huggingface dataset:
Program: 167028
Project: 167028
Buggy source:
public boolean removeProperty(SqlgProperty sqlgProperty,String key){
  SqlgElement sqlgElement=(SqlgElement)sqlgProperty.element();
  SchemaTable schemaTable=SchemaTable.of(sqlgElement.getSchema(),sqlgElement.getTable());
  if (Vertex.class.isAssignableFrom(sqlgElement.getClass())) {
    Pair<SortedSet<String>,Map<SqlgVertex,Map<String,Object>>> triples=this.vertexCache.get(schemaTable);
    if (triples != null) {
      Map<String,Object> triple=triples.getRight().get(sqlgElement);
      if (triple != null) {
        triple.remove(key);
        return true;
      }
    }
  }
 else {
    Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> triples=this.edgeCache.get(schemaTable);
    if (triples != null) {
      Triple<SqlgVertex,SqlgVertex,Map<String,Object>> triple=triples.getRight().get(sqlgElement);
      if (triple != null) {
        triple.getRight().remove(key);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
boolean removeProperty(SqlgProperty sqlgProperty,String key){
  SqlgElement sqlgElement=(SqlgElement)sqlgProperty.element();
  SchemaTable schemaTable=SchemaTable.of(sqlgElement.getSchema(),sqlgElement.getTable());
  if (Vertex.class.isAssignableFrom(sqlgElement.getClass())) {
    Pair<SortedSet<String>,Map<SqlgVertex,Map<String,Object>>> triples=this.vertexCache.get(schemaTable);
    if (triples != null) {
      Map<String,Object> triple=triples.getRight().get(sqlgElement);
      if (triple != null) {
        triple.remove(key);
        return true;
      }
    }
  }
 else {
    SqlgEdge sqlgEdge=(SqlgEdge)sqlgElement;
    MetaEdge metaEdge=MetaEdge.from(schemaTable,sqlgEdge.getOutVertex(),sqlgEdge.getInVertex());
    Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> triples=this.edgeCache.get(metaEdge);
    if (triples != null) {
      Triple<SqlgVertex,SqlgVertex,Map<String,Object>> triple=triples.getRight().get(sqlgElement);
      if (triple != null) {
        triple.getRight().remove(key);
        return true;
      }
    }
  }
  return false;
}
Program: 167029
Project: 167029
Buggy source:
@Override public Iterator<Vertex> vertices(Direction direction,String... edgeLabels){
  SqlgVertex.this.sqlgGraph.tx().readWrite();
  if (this.sqlgGraph.tx().getBatchManager().isStreaming()) {
    throw new IllegalStateException("String_Node_Str");
  }
  return SqlgVertex.this.vertices(Collections.emptyList(),direction,edgeLabels);
}

Fixed version (ground truth):
@Override public Iterator<Vertex> vertices(Direction direction,String... edgeLabels){
  SqlgVertex.this.sqlgGraph.tx().readWrite();
  if (this.sqlgGraph.tx().getBatchManager().isStreaming()) {
    throw new IllegalStateException("String_Node_Str");
  }
  return vertices(Collections.emptyList(),direction,edgeLabels);
}
Program: 167031
Project: 167031
Buggy source:
@Override public Iterator<Edge> edges(Direction direction,String... edgeLabels){
  SqlgVertex.this.sqlgGraph.tx().readWrite();
  if (this.sqlgGraph.tx().getBatchManager().isStreaming()) {
    throw new IllegalStateException("String_Node_Str");
  }
  return SqlgVertex.this.internalEdges(direction,edgeLabels);
}

Fixed version (ground truth):
@Override public Iterator<Edge> edges(Direction direction,String... edgeLabels){
  SqlgVertex.this.sqlgGraph.tx().readWrite();
  if (this.sqlgGraph.tx().getBatchManager().isStreaming()) {
    throw new IllegalStateException("String_Node_Str");
  }
  return internalEdges(direction,edgeLabels);
}
Program: 167033
Project: 167033
Buggy source:
@Override public void flushEdgeCache(SqlgGraph sqlgGraph,Map<SchemaTable,Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>>> edgeCache){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void flushEdgeCache(SqlgGraph sqlgGraph,Map<MetaEdge,Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>>> edgeCache){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 167036
Project: 167036
Buggy source:
private void removeObsoleteHasContainers(SchemaTableTree schemaTableTree){
  Set<HasContainer> toRemove=new HashSet<>();
  schemaTableTree.hasContainers.forEach(hasContainer -> {
    if (hasContainer.getKey().equals(label.getAccessor()) && hasContainer.getBiPredicate().equals(Compare.eq)) {
      SchemaTable hasContainerLabelSchemaTable;
      if (schemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.VERTEX_PREFIX)) {
        hasContainerLabelSchemaTable=SchemaTable.from(this.sqlgGraph,SchemaManager.VERTEX_PREFIX + hasContainer.getValue().toString(),this.sqlgGraph.getSqlDialect().getPublicSchema());
      }
 else {
        hasContainerLabelSchemaTable=SchemaTable.from(this.sqlgGraph,SchemaManager.EDGE_PREFIX + hasContainer.getValue().toString(),this.sqlgGraph.getSqlDialect().getPublicSchema());
      }
      if (hasContainerLabelSchemaTable.toString().equals(schemaTableTree.getSchemaTable().toString())) {
        toRemove.add(hasContainer);
      }
    }
  }
);
  schemaTableTree.hasContainers.removeAll(toRemove);
}

Fixed version (ground truth):
private void removeObsoleteHasContainers(final SchemaTableTree schemaTableTree){
  Set<HasContainer> toRemove=new HashSet<>();
  schemaTableTree.hasContainers.forEach(hasContainer -> {
    if (hasContainer.getKey().equals(label.getAccessor()) && hasContainer.getBiPredicate().equals(Compare.eq)) {
      SchemaTable hasContainerLabelSchemaTable;
      if (schemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.VERTEX_PREFIX)) {
        hasContainerLabelSchemaTable=SchemaTable.from(this.sqlgGraph,SchemaManager.VERTEX_PREFIX + hasContainer.getValue().toString(),this.sqlgGraph.getSqlDialect().getPublicSchema());
      }
 else {
        hasContainerLabelSchemaTable=SchemaTable.from(this.sqlgGraph,SchemaManager.EDGE_PREFIX + hasContainer.getValue().toString(),this.sqlgGraph.getSqlDialect().getPublicSchema());
      }
      if (hasContainerLabelSchemaTable.toString().equals(schemaTableTree.getSchemaTable().toString())) {
        toRemove.add(hasContainer);
      }
    }
  }
);
  schemaTableTree.hasContainers.removeAll(toRemove);
}
Program: 167037
Project: 167037
Buggy source:
private boolean invalidateByHas(SchemaTableTree schemaTableTree){
  for (  HasContainer hasContainer : schemaTableTree.hasContainers) {
    if (!hasContainer.getKey().equals(TopologyStrategy.TOPOLOGY_SELECTION_WITHOUT) && !hasContainer.getKey().equals(TopologyStrategy.TOPOLOGY_SELECTION_FROM)) {
      if (hasContainer.getKey().equals(label.getAccessor())) {
        SchemaTable hasContainerLabelSchemaTable;
        if (schemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.VERTEX_PREFIX)) {
          hasContainerLabelSchemaTable=SchemaTable.from(this.sqlgGraph,SchemaManager.VERTEX_PREFIX + hasContainer.getValue().toString(),this.sqlgGraph.getSqlDialect().getPublicSchema());
        }
 else {
          hasContainerLabelSchemaTable=SchemaTable.from(this.sqlgGraph,SchemaManager.EDGE_PREFIX + hasContainer.getValue().toString(),this.sqlgGraph.getSqlDialect().getPublicSchema());
        }
        if (hasContainer.getBiPredicate().equals(Compare.eq) && !hasContainerLabelSchemaTable.toString().equals(schemaTableTree.getSchemaTable().toString())) {
          return true;
        }
      }
 else       if (!hasContainer.getKey().equals(T.id.getAccessor())) {
        if (!this.getFilteredAllTables().get(schemaTableTree.getSchemaTable().toString()).containsKey(hasContainer.getKey())) {
          return true;
        }
        if (hasEmptyWithin(hasContainer)) {
          return true;
        }
      }
 else       if (hasEmptyWithin(hasContainer)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean invalidateByHas(SchemaTableTree schemaTableTree){
  for (  HasContainer hasContainer : schemaTableTree.hasContainers) {
    if (!hasContainer.getKey().equals(TopologyStrategy.TOPOLOGY_SELECTION_WITHOUT) && !hasContainer.getKey().equals(TopologyStrategy.TOPOLOGY_SELECTION_FROM)) {
      if (!hasContainer.getKey().equals(T.id.getAccessor())) {
        if (!this.getFilteredAllTables().get(schemaTableTree.getSchemaTable().toString()).containsKey(hasContainer.getKey())) {
          return true;
        }
        if (hasEmptyWithin(hasContainer)) {
          return true;
        }
      }
 else       if (hasEmptyWithin(hasContainer)) {
        return true;
      }
    }
  }
  return false;
}
Program: 167039
Project: 167039
Buggy source:
/** 
 * This constructor is called for the root SchemaTableTree(s) <p> This is invoked from   {@link ReplacedStep} when creating the root {@link SchemaTableTree}s. The hasContainers at this stage contains the   {@link TopologyStrategy} from or without hasContainer.After doing the filtering it must be removed from the hasContainers as it must not partake in sql generation.
 */
SchemaTableTree(SqlgGraph sqlgGraph,SchemaTable schemaTable,int stepDepth,List<HasContainer> hasContainers,List<org.javatuples.Pair<Traversal.Admin,Comparator>> comparators,STEP_TYPE stepType,boolean emit,boolean untilFirst,boolean optionalLeftJoin,int replacedStepDepth,Set<String> labels){
  this(sqlgGraph,schemaTable,stepDepth,replacedStepDepth);
  this.hasContainers=hasContainers;
  this.comparators=comparators;
  this.labels=Collections.unmodifiableSet(labels);
  this.stepType=stepType;
  this.emit=emit;
  this.untilFirst=untilFirst;
  this.optionalLeftJoin=optionalLeftJoin;
  this.filteredAllTables=SqlgUtil.filterHasContainers(sqlgGraph.getSchemaManager(),this.hasContainers);
  SqlgUtil.removeTopologyStrategyHasContainer(this.hasContainers);
  initializeAliasColumnNameMaps();
}

Fixed version (ground truth):
/** 
 * This constructor is called for the root SchemaTableTree(s) <p> This is invoked from   {@link ReplacedStep} when creating the root {@link SchemaTableTree}s. The hasContainers at this stage contains the   {@link TopologyStrategy} from or without hasContainer.After doing the filtering it must be removed from the hasContainers as it must not partake in sql generation.
 */
SchemaTableTree(SqlgGraph sqlgGraph,SchemaTable schemaTable,int stepDepth,List<HasContainer> hasContainers,List<org.javatuples.Pair<Traversal.Admin,Comparator>> comparators,STEP_TYPE stepType,boolean emit,boolean untilFirst,boolean optionalLeftJoin,int replacedStepDepth,Set<String> labels){
  this(sqlgGraph,schemaTable,stepDepth,replacedStepDepth);
  this.hasContainers=hasContainers;
  this.comparators=comparators;
  this.labels=Collections.unmodifiableSet(labels);
  this.stepType=stepType;
  this.emit=emit;
  this.untilFirst=untilFirst;
  this.optionalLeftJoin=optionalLeftJoin;
  this.filteredAllTables=SqlgUtil.filterHasContainers(sqlgGraph.getSchemaManager(),this.hasContainers);
  initializeAliasColumnNameMaps();
}
Program: 167042
Project: 167042
Buggy source:
static void addVertexColumn(SqlgGraph sqlgGraph,String schema,String prefixedTable,Map.Entry<String,PropertyType> column){
  BatchManager.BatchModeType batchModeType=flushAndSetTxToNone(sqlgGraph);
  try {
    Preconditions.checkArgument(prefixedTable.startsWith(SchemaManager.VERTEX_PREFIX),"String_Node_Str" + prefixedTable);
    GraphTraversalSource traversalSource=sqlgGraph.traversal().withStrategies(TopologyStrategy.build().selectFrom(SchemaManager.SQLG_SCHEMA_SCHEMA_TABLES).create());
    List<Vertex> vertices=traversalSource.V().hasLabel(SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_SCHEMA).has("String_Node_Str",schema).out(SchemaManager.SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).has("String_Node_Str",prefixedTable.substring(SchemaManager.VERTEX_PREFIX.length())).toList();
    if (vertices.size() == 0) {
      throw new IllegalStateException("String_Node_Str" + schema + "String_Node_Str"+ prefixedTable);
    }
    if (vertices.size() > 1) {
      throw new IllegalStateException("String_Node_Str" + schema + "String_Node_Str"+ prefixedTable);
    }
    Vertex vertex=vertices.get(0);
    Vertex property=sqlgGraph.addVertex(T.label,SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_PROPERTY,"String_Node_Str",column.getKey(),"String_Node_Str",column.getValue().name(),"String_Node_Str",LocalDateTime.now());
    vertex.addEdge(SchemaManager.SQLG_SCHEMA_VERTEX_PROPERTIES_EDGE,property);
  }
  finally {
    sqlgGraph.tx().batchMode(batchModeType);
  }
}

Fixed version (ground truth):
static void addVertexColumn(SqlgGraph sqlgGraph,String schema,String prefixedTable,Map.Entry<String,PropertyType> column){
  BatchManager.BatchModeType batchModeType=flushAndSetTxToNone(sqlgGraph);
  try {
    Preconditions.checkArgument(prefixedTable.startsWith(SchemaManager.VERTEX_PREFIX),"String_Node_Str" + prefixedTable);
    GraphTraversalSource traversalSource=sqlgGraph.topology();
    List<Vertex> vertices=traversalSource.V().hasLabel(SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_SCHEMA).has("String_Node_Str",schema).out(SchemaManager.SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).has("String_Node_Str",prefixedTable.substring(SchemaManager.VERTEX_PREFIX.length())).toList();
    if (vertices.size() == 0) {
      throw new IllegalStateException("String_Node_Str" + schema + "String_Node_Str"+ prefixedTable);
    }
    if (vertices.size() > 1) {
      throw new IllegalStateException("String_Node_Str" + schema + "String_Node_Str"+ prefixedTable);
    }
    Vertex vertex=vertices.get(0);
    Vertex property=sqlgGraph.addVertex(T.label,SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_PROPERTY,"String_Node_Str",column.getKey(),"String_Node_Str",column.getValue().name(),"String_Node_Str",LocalDateTime.now());
    vertex.addEdge(SchemaManager.SQLG_SCHEMA_VERTEX_PROPERTIES_EDGE,property);
  }
  finally {
    sqlgGraph.tx().batchMode(batchModeType);
  }
}
Program: 167045
Project: 167045
Buggy source:
static void addEdgeColumn(SqlgGraph sqlgGraph,String schema,String prefixedTable,Map.Entry<String,PropertyType> column){
  BatchManager.BatchModeType batchModeType=flushAndSetTxToNone(sqlgGraph);
  try {
    Preconditions.checkArgument(prefixedTable.startsWith(SchemaManager.EDGE_PREFIX),"String_Node_Str" + prefixedTable);
    GraphTraversalSource traversalSource=sqlgGraph.traversal().withStrategies(TopologyStrategy.build().selectFrom(SchemaManager.SQLG_SCHEMA_SCHEMA_TABLES).create());
    Set<Vertex> edges=traversalSource.V().hasLabel(SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_EDGE_LABEL).has("String_Node_Str",prefixedTable.substring(SchemaManager.EDGE_PREFIX.length())).as("String_Node_Str").in(SchemaManager.SQLG_SCHEMA_OUT_EDGES_EDGE).in(SchemaManager.SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).has("String_Node_Str",schema).<Vertex>select("String_Node_Str").toSet();
    if (edges.size() == 0) {
      throw new IllegalStateException("String_Node_Str" + prefixedTable);
    }
    if (edges.size() > 1) {
      throw new IllegalStateException("String_Node_Str" + prefixedTable);
    }
    Vertex edge=edges.iterator().next();
    Vertex property=sqlgGraph.addVertex(T.label,SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_PROPERTY,"String_Node_Str",column.getKey(),"String_Node_Str",column.getValue().name(),"String_Node_Str",LocalDateTime.now());
    edge.addEdge(SchemaManager.SQLG_SCHEMA_EDGE_PROPERTIES_EDGE,property);
  }
  finally {
    sqlgGraph.tx().batchMode(batchModeType);
  }
}

Fixed version (ground truth):
static void addEdgeColumn(SqlgGraph sqlgGraph,String schema,String prefixedTable,Map.Entry<String,PropertyType> column){
  BatchManager.BatchModeType batchModeType=flushAndSetTxToNone(sqlgGraph);
  try {
    Preconditions.checkArgument(prefixedTable.startsWith(SchemaManager.EDGE_PREFIX),"String_Node_Str" + prefixedTable);
    GraphTraversalSource traversalSource=sqlgGraph.topology();
    Set<Vertex> edges=traversalSource.V().hasLabel(SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_EDGE_LABEL).has("String_Node_Str",prefixedTable.substring(SchemaManager.EDGE_PREFIX.length())).as("String_Node_Str").in(SchemaManager.SQLG_SCHEMA_OUT_EDGES_EDGE).in(SchemaManager.SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).has("String_Node_Str",schema).<Vertex>select("String_Node_Str").toSet();
    if (edges.size() == 0) {
      throw new IllegalStateException("String_Node_Str" + prefixedTable);
    }
    if (edges.size() > 1) {
      throw new IllegalStateException("String_Node_Str" + prefixedTable);
    }
    Vertex edge=edges.iterator().next();
    Vertex property=sqlgGraph.addVertex(T.label,SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_PROPERTY,"String_Node_Str",column.getKey(),"String_Node_Str",column.getValue().name(),"String_Node_Str",LocalDateTime.now());
    edge.addEdge(SchemaManager.SQLG_SCHEMA_EDGE_PROPERTIES_EDGE,property);
  }
  finally {
    sqlgGraph.tx().batchMode(batchModeType);
  }
}
Program: 167046
Project: 167046
Buggy source:
private static Object[] getArray(Object val){
  int arrlength=Array.getLength(val);
  Object[] outputArray=new Object[arrlength];
  for (int i=0; i < arrlength; ++i) {
    outputArray[i]=Array.get(val,i);
  }
  return outputArray;
}

Fixed version (ground truth):
private static Object[] getArray(PropertyType propertyType,Object val){
  int arrlength=Array.getLength(val);
  Object[] outputArray=new Object[arrlength];
  for (int i=0; i < arrlength; ++i) {
switch (propertyType) {
case LOCALDATETIME_ARRAY:
      outputArray[i]=Timestamp.valueOf((LocalDateTime)Array.get(val,i));
    break;
default :
  outputArray[i]=Array.get(val,i);
}
}
return outputArray;
}
Program: 167047
Project: 167047
Buggy source:
/** 
 * This only gets called for array properties
 * @param propertyType
 * @param value
 * @return
 */
public static Object[] transformArrayToInsertValue(PropertyType propertyType,Object value){
  return getArray(value);
}

Fixed version (ground truth):
/** 
 * This only gets called for array properties
 * @param propertyType
 * @param value
 * @return
 */
public static Object[] transformArrayToInsertValue(PropertyType propertyType,Object value){
  return getArray(propertyType,value);
}
Program: 167050
Project: 167050
Buggy source:
@Override public String getArrayDriverType(PropertyType propertyType){
switch (propertyType) {
case BOOLEAN_ARRAY:
    return "String_Node_Str";
case SHORT_ARRAY:
  return "String_Node_Str";
case INTEGER_ARRAY:
return "String_Node_Str";
case LONG_ARRAY:
return "String_Node_Str";
case DOUBLE_ARRAY:
return "String_Node_Str";
case STRING_ARRAY:
return "String_Node_Str";
default :
throw new IllegalStateException("String_Node_Str" + propertyType.name() + "String_Node_Str");
}
}

Fixed version (ground truth):
@Override public String getArrayDriverType(PropertyType propertyType){
switch (propertyType) {
case BOOLEAN_ARRAY:
    return "String_Node_Str";
case SHORT_ARRAY:
  return "String_Node_Str";
case INTEGER_ARRAY:
return "String_Node_Str";
case LONG_ARRAY:
return "String_Node_Str";
case DOUBLE_ARRAY:
return "String_Node_Str";
case STRING_ARRAY:
return "String_Node_Str";
case LOCALDATETIME_ARRAY:
return "String_Node_Str";
case LOCALDATE_ARRAY:
return "String_Node_Str";
case LOCALTIME_ARRAY:
return "String_Node_Str";
default :
throw new IllegalStateException("String_Node_Str" + propertyType.name() + "String_Node_Str");
}
}
Program: 167052
Project: 167052
Buggy source:
void ensureColumnsExist(String schema,String prefixedTable,Map<String,PropertyType> columns){
  boolean isVertex=prefixedTable.startsWith(VERTEX_PREFIX);
  boolean isEdge=prefixedTable.startsWith(EDGE_PREFIX);
  if (!isVertex && !isEdge) {
    throw new IllegalStateException("String_Node_Str" + VERTEX_PREFIX + "String_Node_Str"+ EDGE_PREFIX);
  }
  Map<String,PropertyType> uncommittedColumns=internalGetColumn(schema,prefixedTable);
  Objects.requireNonNull(uncommittedColumns,"String_Node_Str");
  for (  Map.Entry<String,PropertyType> column : columns.entrySet()) {
    String columnName=column.getKey();
    PropertyType columnType=column.getValue();
    if (!uncommittedColumns.containsKey(columnName)) {
      uncommittedColumns=internalGetColumn(schema,prefixedTable);
    }
    if (!uncommittedColumns.containsKey(columnName)) {
      lock(schema,prefixedTable);
      if (!uncommittedColumns.containsKey(columnName)) {
        if (!SQLG_SCHEMA.equals(schema)) {
          if (isVertex) {
            TopologyManager.addVertexColumn(this.sqlgGraph,schema,prefixedTable,column);
          }
 else {
            TopologyManager.addEdgeColumn(this.sqlgGraph,schema,prefixedTable,column);
          }
        }
        addColumn(schema,prefixedTable,ImmutablePair.of(columnName,columnType));
        uncommittedColumns.put(columnName,columnType);
        this.uncommittedTables.put(schema + "String_Node_Str" + prefixedTable,uncommittedColumns);
      }
    }
  }
}

Fixed version (ground truth):
private void ensureColumnsExist(String schema,String prefixedTable,Map<String,PropertyType> columns){
  boolean isVertex=prefixedTable.startsWith(VERTEX_PREFIX);
  boolean isEdge=prefixedTable.startsWith(EDGE_PREFIX);
  if (!isVertex && !isEdge) {
    throw new IllegalStateException("String_Node_Str" + VERTEX_PREFIX + "String_Node_Str"+ EDGE_PREFIX);
  }
  Map<String,PropertyType> uncommittedColumns=internalGetColumn(schema,prefixedTable);
  Objects.requireNonNull(uncommittedColumns,"String_Node_Str");
  for (  Map.Entry<String,PropertyType> column : columns.entrySet()) {
    String columnName=column.getKey();
    PropertyType columnType=column.getValue();
    if (!uncommittedColumns.containsKey(columnName)) {
      uncommittedColumns=internalGetColumn(schema,prefixedTable);
    }
    if (!uncommittedColumns.containsKey(columnName)) {
      lock(schema,prefixedTable);
      if (!uncommittedColumns.containsKey(columnName)) {
        if (!SQLG_SCHEMA.equals(schema)) {
          if (isVertex) {
            TopologyManager.addVertexColumn(this.sqlgGraph,schema,prefixedTable,column);
          }
 else {
            TopologyManager.addEdgeColumn(this.sqlgGraph,schema,prefixedTable,column);
          }
        }
        addColumn(schema,prefixedTable,ImmutablePair.of(columnName,columnType));
        uncommittedColumns.put(columnName,columnType);
        this.uncommittedTables.put(schema + "String_Node_Str" + prefixedTable,uncommittedColumns);
      }
    }
  }
}
Program: 167054
Project: 167054
Buggy source:
static void addEdgeColumn(SqlgGraph sqlgGraph,String schema,String prefixedTable,Map.Entry<String,PropertyType> column){
  BatchManager.BatchModeType batchModeType=flushAndSetTxToNone(sqlgGraph);
  try {
    Preconditions.checkArgument(prefixedTable.startsWith(SchemaManager.EDGE_PREFIX),"String_Node_Str" + prefixedTable);
    GraphTraversalSource traversalSource=sqlgGraph.traversal().withStrategies(TopologyStrategy.build().selectFrom(SchemaManager.SQLG_SCHEMA_SCHEMA_TABLES).create());
    List<Vertex> edges=traversalSource.V().hasLabel(SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_EDGE_LABEL).has("String_Node_Str",prefixedTable.substring(SchemaManager.EDGE_PREFIX.length())).as("String_Node_Str").in(SchemaManager.SQLG_SCHEMA_OUT_EDGES_EDGE).in(SchemaManager.SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).has("String_Node_Str",schema).<Vertex>select("String_Node_Str").toList();
    if (edges.size() == 0) {
      throw new IllegalStateException("String_Node_Str" + prefixedTable);
    }
    if (edges.size() > 1) {
      throw new IllegalStateException("String_Node_Str" + prefixedTable);
    }
    Vertex edge=edges.get(0);
    Vertex property=sqlgGraph.addVertex(T.label,SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_PROPERTY,"String_Node_Str",column.getKey(),"String_Node_Str",column.getValue().name(),"String_Node_Str",LocalDateTime.now());
    edge.addEdge(SchemaManager.SQLG_SCHEMA_EDGE_PROPERTIES_EDGE,property);
  }
  finally {
    sqlgGraph.tx().batchMode(batchModeType);
  }
}

Fixed version (ground truth):
static void addEdgeColumn(SqlgGraph sqlgGraph,String schema,String prefixedTable,Map.Entry<String,PropertyType> column){
  BatchManager.BatchModeType batchModeType=flushAndSetTxToNone(sqlgGraph);
  try {
    Preconditions.checkArgument(prefixedTable.startsWith(SchemaManager.EDGE_PREFIX),"String_Node_Str" + prefixedTable);
    GraphTraversalSource traversalSource=sqlgGraph.traversal().withStrategies(TopologyStrategy.build().selectFrom(SchemaManager.SQLG_SCHEMA_SCHEMA_TABLES).create());
    Set<Vertex> edges=traversalSource.V().hasLabel(SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_EDGE_LABEL).has("String_Node_Str",prefixedTable.substring(SchemaManager.EDGE_PREFIX.length())).as("String_Node_Str").in(SchemaManager.SQLG_SCHEMA_OUT_EDGES_EDGE).in(SchemaManager.SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).has("String_Node_Str",schema).<Vertex>select("String_Node_Str").toSet();
    if (edges.size() == 0) {
      throw new IllegalStateException("String_Node_Str" + prefixedTable);
    }
    if (edges.size() > 1) {
      throw new IllegalStateException("String_Node_Str" + prefixedTable);
    }
    Vertex edge=edges.iterator().next();
    Vertex property=sqlgGraph.addVertex(T.label,SchemaManager.SQLG_SCHEMA + "String_Node_Str" + SchemaManager.SQLG_SCHEMA_PROPERTY,"String_Node_Str",column.getKey(),"String_Node_Str",column.getValue().name(),"String_Node_Str",LocalDateTime.now());
    edge.addEdge(SchemaManager.SQLG_SCHEMA_EDGE_PROPERTIES_EDGE,property);
  }
  finally {
    sqlgGraph.tx().batchMode(batchModeType);
  }
}
Program: 167056
Project: 167056
Buggy source:
public Traversal<Vertex,Long> get_g_V_both_both_count(GraphTraversalSource g){
  return g.V().both().both().count();
}

Fixed version (ground truth):
private Traversal<Vertex,Long> get_g_V_both_both_count(GraphTraversalSource g){
  return g.V().both().both().count();
}
Program: 167061
Project: 167061
Buggy source:
@Test public void testRepeatBoth(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex b1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex c1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  a1.addEdge("String_Node_Str",b1);
  b1.addEdge("String_Node_Str",c1);
  this.sqlgGraph.tx().commit();
  List<Vertex> vertices=this.sqlgGraph.traversal().V(b1).repeat(__.both()).times(3).toList();
  Assert.assertEquals(4,vertices.size());
}

Fixed version (ground truth):
@Test public void testRepeatBoth(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex b1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex c1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  a1.addEdge("String_Node_Str",b1);
  b1.addEdge("String_Node_Str",c1);
  this.sqlgGraph.tx().commit();
  List<Vertex> vertices=this.sqlgGraph.traversal().V(b1).repeat(both()).times(3).toList();
  Assert.assertEquals(4,vertices.size());
}
Program: 167062
Project: 167062
Buggy source:
@Override public void loadResultSet(ResultSet resultSet) throws SQLException {
  ResultSetMetaData resultSetMetaData=resultSet.getMetaData();
  for (int i=1; i <= resultSetMetaData.getColumnCount(); i++) {
    String columnName=resultSetMetaData.getColumnLabel(i);
    Object o=resultSet.getObject(columnName);
    if (!columnName.equals("String_Node_Str") && !columnName.equals(SchemaManager.VERTEX_SCHEMA) && !columnName.equals(SchemaManager.VERTEX_TABLE)&& !Objects.isNull(o)) {
      loadProperty(resultSetMetaData,resultSet,i,columnName,o);
    }
  }
}

Fixed version (ground truth):
@Override public void loadResultSet(ResultSet resultSet) throws SQLException {
  ResultSetMetaData resultSetMetaData=resultSet.getMetaData();
  for (int i=1; i <= resultSetMetaData.getColumnCount(); i++) {
    String columnName=resultSetMetaData.getColumnLabel(i);
    Object o=resultSet.getObject(columnName);
    if (!columnName.equals("String_Node_Str") && !columnName.equals(SchemaManager.VERTEX_SCHEMA) && !columnName.equals(SchemaManager.VERTEX_TABLE)&& !this.sqlgGraph.getSqlDialect().columnsToIgnore().contains(columnName)&& !Objects.isNull(o)) {
      loadProperty(resultSetMetaData,resultSet,i,columnName,o);
    }
  }
}
Program: 167063
Project: 167063
Buggy source:
private static BatchManager.BatchModeType flushAndSetTxToNone(SqlgGraph sqlgGraph){
  BatchManager.BatchModeType batchModeType=null;
  if (sqlgGraph.tx().isInBatchMode()) {
    batchModeType=sqlgGraph.tx().getBatchModeType();
    sqlgGraph.tx().flush();
    sqlgGraph.tx().batchMode(BatchManager.BatchModeType.NONE);
  }
  return batchModeType;
}

Fixed version (ground truth):
private static BatchManager.BatchModeType flushAndSetTxToNone(SqlgGraph sqlgGraph){
  BatchManager.BatchModeType batchModeType=sqlgGraph.tx().getBatchModeType();
  if (sqlgGraph.tx().isInBatchMode()) {
    batchModeType=sqlgGraph.tx().getBatchModeType();
    sqlgGraph.tx().flush();
    sqlgGraph.tx().batchMode(BatchManager.BatchModeType.NONE);
  }
  return batchModeType;
}
Program: 167064
Project: 167064
Buggy source:
@Override public String constructCompleteCopyCommandSqlVertex(SqlgGraph sqlgGraph,SqlgVertex vertex,Map<String,Object> keyValueMap){
  StringBuffer sql=new StringBuffer();
  sql.append("String_Node_Str");
  sql.append(maybeWrapInQoutes(vertex.getSchema()));
  sql.append("String_Node_Str");
  sql.append(maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + vertex.getTable()));
  sql.append("String_Node_Str");
  if (keyValueMap.isEmpty()) {
    sqlgGraph.getSchemaManager().ensureColumnExist(vertex.getSchema(),SchemaManager.VERTEX_PREFIX + vertex.getTable(),ImmutablePair.of("String_Node_Str",PropertyType.from(0)));
    sql.append(maybeWrapInQoutes("String_Node_Str"));
  }
 else {
    int count=1;
    for (    String key : keyValueMap.keySet()) {
      if (count > 1 && count <= keyValueMap.size()) {
        sql.append("String_Node_Str");
      }
      count++;
      sql.append(maybeWrapInQoutes(key));
    }
  }
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(COPY_COMMAND_SEPARATOR);
  sql.append("String_Node_Str");
  if (logger.isDebugEnabled()) {
    logger.debug(sql.toString());
  }
  return sql.toString();
}

Fixed version (ground truth):
@Override public String constructCompleteCopyCommandSqlVertex(SqlgGraph sqlgGraph,SqlgVertex vertex,Map<String,Object> keyValueMap){
  StringBuffer sql=new StringBuffer();
  sql.append("String_Node_Str");
  sql.append(maybeWrapInQoutes(vertex.getSchema()));
  sql.append("String_Node_Str");
  sql.append(maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + vertex.getTable()));
  sql.append("String_Node_Str");
  if (keyValueMap.isEmpty()) {
    sqlgGraph.getSchemaManager().ensureColumnExist(vertex.getSchema(),SchemaManager.VERTEX_PREFIX + vertex.getTable(),ImmutablePair.of(COPY_DUMMY,PropertyType.from(0)));
    sql.append(maybeWrapInQoutes(COPY_DUMMY));
  }
 else {
    int count=1;
    for (    String key : keyValueMap.keySet()) {
      if (count > 1 && count <= keyValueMap.size()) {
        sql.append("String_Node_Str");
      }
      count++;
      sql.append(maybeWrapInQoutes(key));
    }
  }
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(COPY_COMMAND_SEPARATOR);
  sql.append("String_Node_Str");
  if (logger.isDebugEnabled()) {
    logger.debug(sql.toString());
  }
  return sql.toString();
}
Program: 167065
Project: 167065
Buggy source:
@Override public String constructManualCopyCommandSqlVertex(SqlgGraph sqlgGraph,SchemaTable schemaTable,Map<String,Object> keyValueMap){
  StringBuffer sql=new StringBuffer();
  sql.append("String_Node_Str");
  sql.append(maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + schemaTable.getTable()));
  sql.append("String_Node_Str");
  if (keyValueMap.isEmpty()) {
    sqlgGraph.getSchemaManager().ensureColumnExist(schemaTable.getSchema(),SchemaManager.VERTEX_PREFIX + schemaTable.getTable(),ImmutablePair.of("String_Node_Str",PropertyType.from(0)));
    sql.append(maybeWrapInQoutes("String_Node_Str"));
  }
 else {
    int count=1;
    for (    String key : keyValueMap.keySet()) {
      if (count > 1 && count <= keyValueMap.size()) {
        sql.append("String_Node_Str");
      }
      count++;
      sql.append(maybeWrapInQoutes(key));
    }
  }
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(COPY_COMMAND_SEPARATOR);
  sql.append("String_Node_Str");
  if (logger.isDebugEnabled()) {
    logger.debug(sql.toString());
  }
  return sql.toString();
}

Fixed version (ground truth):
@Override public String constructManualCopyCommandSqlVertex(SqlgGraph sqlgGraph,SchemaTable schemaTable,Map<String,Object> keyValueMap){
  StringBuffer sql=new StringBuffer();
  sql.append("String_Node_Str");
  sql.append(maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + schemaTable.getTable()));
  sql.append("String_Node_Str");
  if (keyValueMap.isEmpty()) {
    sqlgGraph.getSchemaManager().ensureColumnExist(schemaTable.getSchema(),SchemaManager.VERTEX_PREFIX + schemaTable.getTable(),ImmutablePair.of(COPY_DUMMY,PropertyType.from(0)));
    sql.append(maybeWrapInQoutes(COPY_DUMMY));
  }
 else {
    int count=1;
    for (    String key : keyValueMap.keySet()) {
      if (count > 1 && count <= keyValueMap.size()) {
        sql.append("String_Node_Str");
      }
      count++;
      sql.append(maybeWrapInQoutes(key));
    }
  }
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(COPY_COMMAND_SEPARATOR);
  sql.append("String_Node_Str");
  if (logger.isDebugEnabled()) {
    logger.debug(sql.toString());
  }
  return sql.toString();
}
Program: 167067
Project: 167067
Buggy source:
@Test public void testGetEdges(){
  this.sqlgGraph.tx().normalBatchModeOn();
  Vertex root=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex god=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Edge sqlgEdge=root.addEdge("String_Node_Str",god);
  Assert.assertEquals(sqlgEdge,vertexTraversal(root).outE("String_Node_Str").next());
  this.sqlgGraph.tx().commit();
}

Fixed version (ground truth):
@Test public void testGetEdges(){
  this.sqlgGraph.tx().normalBatchModeOn();
  Vertex root=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex god=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Edge sqlgEdge=root.addEdge("String_Node_Str",god);
  Assert.assertNull(sqlgEdge.id());
  Edge rootGodEdge=vertexTraversal(root).outE("String_Node_Str").next();
  Assert.assertNotNull(rootGodEdge);
  Assert.assertNotNull(rootGodEdge.id());
  this.sqlgGraph.tx().commit();
}
Program: 167069
Project: 167069
Buggy source:
void flushEdgeCache(SqlgGraph sqlgGraph,Map<SchemaTable,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> edgeCache);

Fixed version (ground truth):
void flushEdgeCache(SqlgGraph sqlgGraph,Map<SchemaTable,Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>>> edgeCache);
Program: 167070
Project: 167070
Buggy source:
Map<SchemaTable,Pair<Long,Long>> flushVertexCache(SqlgGraph sqlgGraph,Map<SchemaTable,Pair<SortedSet<String>,Map<SqlgVertex,Triple<String,String,Map<String,Object>>>>> vertexCache);

Fixed version (ground truth):
Map<SchemaTable,Pair<Long,Long>> flushVertexCache(SqlgGraph sqlgGraph,Map<SchemaTable,Pair<SortedSet<String>,Map<SqlgVertex,Map<String,Object>>>> vertexCache);
Program: 167071
Project: 167071
Buggy source:
public boolean vertexIsCached(SqlgVertex vertex){
  Pair<SortedSet<String>,Map<SqlgVertex,Triple<String,String,Map<String,Object>>>> map=this.vertexCache.get(SchemaTable.of(vertex.getSchema(),vertex.getTable()));
  return map != null && map.getRight().containsKey(vertex);
}

Fixed version (ground truth):
public boolean vertexIsCached(SqlgVertex vertex){
  Pair<SortedSet<String>,Map<SqlgVertex,Map<String,Object>>> map=this.vertexCache.get(SchemaTable.of(vertex.getSchema(),vertex.getTable()));
  return map != null && map.getRight().containsKey(vertex);
}
Program: 167072
Project: 167072
Buggy source:
public void removeEdge(String schema,String table,SqlgEdge edge){
  SchemaTable schemaTable=SchemaTable.of(schema,table);
  Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>> sqlgEdgeTripleMap=this.edgeCache.get(schemaTable);
  if (sqlgEdgeTripleMap != null && sqlgEdgeTripleMap.containsKey(edge)) {
    sqlgEdgeTripleMap.remove(edge);
  }
 else {
    List<SqlgEdge> edges=this.removeEdgeCache.get(schemaTable);
    if (edges == null) {
      edges=new ArrayList<>();
      this.removeEdgeCache.put(schemaTable,edges);
    }
    edges.add(edge);
  }
}

Fixed version (ground truth):
public void removeEdge(String schema,String table,SqlgEdge edge){
  SchemaTable schemaTable=SchemaTable.of(schema,table);
  Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> sqlgEdgeTripleMap=this.edgeCache.get(schemaTable);
  if (sqlgEdgeTripleMap != null && sqlgEdgeTripleMap.getRight().containsKey(edge)) {
    sqlgEdgeTripleMap.getRight().remove(edge);
  }
 else {
    List<SqlgEdge> edges=this.removeEdgeCache.get(schemaTable);
    if (edges == null) {
      edges=new ArrayList<>();
      this.removeEdgeCache.put(schemaTable,edges);
    }
    edges.add(edge);
  }
}
Program: 167077
Project: 167077
Buggy source:
public boolean removeProperty(SqlgProperty sqlgProperty,String key){
  SqlgElement sqlgElement=(SqlgElement)sqlgProperty.element();
  SchemaTable schemaTable=SchemaTable.of(sqlgElement.getSchema(),sqlgElement.getTable());
  if (Vertex.class.isAssignableFrom(sqlgElement.getClass())) {
    Pair<SortedSet<String>,Map<SqlgVertex,Triple<String,String,Map<String,Object>>>> triples=this.vertexCache.get(schemaTable);
    if (triples != null) {
      Triple<String,String,Map<String,Object>> triple=triples.getRight().get(sqlgElement);
      if (triple != null) {
        triple.getRight().remove(key);
        return true;
      }
    }
  }
 else {
    Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>> triples=this.edgeCache.get(schemaTable);
    if (triples != null) {
      Triple<SqlgVertex,SqlgVertex,Map<String,Object>> triple=triples.get(sqlgElement);
      if (triple != null) {
        triple.getRight().remove(key);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean removeProperty(SqlgProperty sqlgProperty,String key){
  SqlgElement sqlgElement=(SqlgElement)sqlgProperty.element();
  SchemaTable schemaTable=SchemaTable.of(sqlgElement.getSchema(),sqlgElement.getTable());
  if (Vertex.class.isAssignableFrom(sqlgElement.getClass())) {
    Pair<SortedSet<String>,Map<SqlgVertex,Map<String,Object>>> triples=this.vertexCache.get(schemaTable);
    if (triples != null) {
      Map<String,Object> triple=triples.getRight().get(sqlgElement);
      if (triple != null) {
        triple.remove(key);
        return true;
      }
    }
  }
 else {
    Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> triples=this.edgeCache.get(schemaTable);
    if (triples != null) {
      Triple<SqlgVertex,SqlgVertex,Map<String,Object>> triple=triples.getRight().get(sqlgElement);
      if (triple != null) {
        triple.getRight().remove(key);
        return true;
      }
    }
  }
  return false;
}
Program: 167078
Project: 167078
Buggy source:
@Override public void flushEdgeCache(SqlgGraph sqlgGraph,Map<SchemaTable,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> edgeCache){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void flushEdgeCache(SqlgGraph sqlgGraph,Map<SchemaTable,Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>>> edgeCache){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 167079
Project: 167079
Buggy source:
@Override public List<String> getSpacialRefTable(){
  return Collections.EMPTY_LIST;
}

Fixed version (ground truth):
@Override public List<String> getSpacialRefTable(){
  return Collections.emptyList();
}
Program: 167080
Project: 167080
Buggy source:
@Override public Map<SchemaTable,Pair<Long,Long>> flushVertexCache(SqlgGraph sqlgGraph,Map<SchemaTable,Pair<SortedSet<String>,Map<SqlgVertex,Triple<String,String,Map<String,Object>>>>> vertexCache){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public Map<SchemaTable,Pair<Long,Long>> flushVertexCache(SqlgGraph sqlgGraph,Map<SchemaTable,Pair<SortedSet<String>,Map<SqlgVertex,Map<String,Object>>>> vertexCache){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 167081
Project: 167081
Buggy source:
@Override public List<String> getGisSchemas(){
  return Collections.EMPTY_LIST;
}

Fixed version (ground truth):
@Override public List<String> getGisSchemas(){
  return Collections.emptyList();
}
Program: 167083
Project: 167083
Buggy source:
@Override public int propertyTypeToJavaSqlType(PropertyType propertyType){
switch (propertyType) {
case BOOLEAN:
    return Types.BOOLEAN;
case SHORT:
  return Types.SMALLINT;
case INTEGER:
return Types.INTEGER;
case LONG:
return Types.BIGINT;
case FLOAT:
return Types.REAL;
case DOUBLE:
return Types.DOUBLE;
case STRING:
return Types.CLOB;
case BYTE_ARRAY:
return Types.ARRAY;
case BOOLEAN_ARRAY:
return Types.ARRAY;
case SHORT_ARRAY:
return Types.ARRAY;
case INTEGER_ARRAY:
return Types.ARRAY;
case LONG_ARRAY:
return Types.ARRAY;
case FLOAT_ARRAY:
return Types.ARRAY;
case DOUBLE_ARRAY:
return Types.ARRAY;
case STRING_ARRAY:
return Types.ARRAY;
default :
throw new IllegalStateException("String_Node_Str" + propertyType.name());
}
}

Fixed version (ground truth):
@Override public int propertyTypeToJavaSqlType(PropertyType propertyType){
switch (propertyType) {
case BOOLEAN:
    return Types.BOOLEAN;
case SHORT:
  return Types.SMALLINT;
case INTEGER:
return Types.INTEGER;
case LONG:
return Types.BIGINT;
case FLOAT:
return Types.REAL;
case DOUBLE:
return Types.DOUBLE;
case STRING:
return Types.CLOB;
case BYTE_ARRAY:
return Types.ARRAY;
case LOCALDATETIME:
return Types.TIMESTAMP;
case LOCALDATE:
return Types.DATE;
case LOCALTIME:
return Types.TIME;
case JSON:
return Types.OTHER;
case BOOLEAN_ARRAY:
return Types.ARRAY;
case SHORT_ARRAY:
return Types.ARRAY;
case INTEGER_ARRAY:
return Types.ARRAY;
case LONG_ARRAY:
return Types.ARRAY;
case FLOAT_ARRAY:
return Types.ARRAY;
case DOUBLE_ARRAY:
return Types.ARRAY;
case STRING_ARRAY:
return Types.ARRAY;
default :
throw new IllegalStateException("String_Node_Str" + propertyType.name());
}
}
Program: 167084
Project: 167084
Buggy source:
@Override public PropertyType sqlTypeToPropertyType(int sqlType,String typeName){
switch (sqlType) {
case Types.BIT:
    return PropertyType.BOOLEAN;
case Types.SMALLINT:
  return PropertyType.SHORT;
case Types.INTEGER:
return PropertyType.INTEGER;
case Types.BIGINT:
return PropertyType.LONG;
case Types.REAL:
return PropertyType.FLOAT;
case Types.DOUBLE:
return PropertyType.DOUBLE;
case Types.VARCHAR:
return PropertyType.STRING;
case Types.BINARY:
return PropertyType.BYTE_ARRAY;
case Types.ARRAY:
switch (typeName) {
case "String_Node_Str":
return PropertyType.BOOLEAN_ARRAY;
case "String_Node_Str":
return PropertyType.SHORT_ARRAY;
case "String_Node_Str":
return PropertyType.INTEGER_ARRAY;
case "String_Node_Str":
return PropertyType.LONG_ARRAY;
case "String_Node_Str":
return PropertyType.FLOAT_ARRAY;
case "String_Node_Str":
return PropertyType.DOUBLE_ARRAY;
case "String_Node_Str":
return PropertyType.STRING_ARRAY;
default :
throw new RuntimeException("String_Node_Str" + typeName);
}
default :
throw new IllegalStateException("String_Node_Str" + sqlType);
}
}

Fixed version (ground truth):
@Override public PropertyType sqlTypeToPropertyType(int sqlType,String typeName){
switch (sqlType) {
case Types.BIT:
    return PropertyType.BOOLEAN;
case Types.SMALLINT:
  return PropertyType.SHORT;
case Types.INTEGER:
return PropertyType.INTEGER;
case Types.BIGINT:
return PropertyType.LONG;
case Types.REAL:
return PropertyType.FLOAT;
case Types.DOUBLE:
return PropertyType.DOUBLE;
case Types.VARCHAR:
return PropertyType.STRING;
case Types.TIMESTAMP:
return PropertyType.LOCALDATETIME;
case Types.DATE:
return PropertyType.LOCALDATE;
case Types.TIME:
return PropertyType.LOCALTIME;
case Types.OTHER:
return PropertyType.JSON;
case Types.BINARY:
return PropertyType.BYTE_ARRAY;
case Types.ARRAY:
switch (typeName) {
case "String_Node_Str":
return PropertyType.BOOLEAN_ARRAY;
case "String_Node_Str":
return PropertyType.SHORT_ARRAY;
case "String_Node_Str":
return PropertyType.INTEGER_ARRAY;
case "String_Node_Str":
return PropertyType.LONG_ARRAY;
case "String_Node_Str":
return PropertyType.FLOAT_ARRAY;
case "String_Node_Str":
return PropertyType.DOUBLE_ARRAY;
case "String_Node_Str":
return PropertyType.STRING_ARRAY;
default :
throw new RuntimeException("String_Node_Str" + typeName);
}
default :
throw new IllegalStateException("String_Node_Str" + sqlType);
}
}
Program: 167088
Project: 167088
Buggy source:
void parseForStrategy(){
  this.parsedForStrategySql.clear();
  Preconditions.checkState(this.replacedSteps.size() > 0,"String_Node_Str");
  Preconditions.checkState(this.replacedSteps.get(0).isGraphStep(),"String_Node_Str");
  Set<SchemaTableTree> rootSchemaTableTrees=this.sqlgGraph.getGremlinParser().parseForStrategy(this.replacedSteps);
  for (  SchemaTableTree rootSchemaTableTree : rootSchemaTableTrees) {
    try {
      List<Pair<LinkedList<SchemaTableTree>,String>> sqlStatements=rootSchemaTableTree.constructSql();
      this.parsedForStrategySql.put(rootSchemaTableTree,sqlStatements);
    }
  finally {
      rootSchemaTableTree.resetThreadVars();
    }
  }
}

Fixed version (ground truth):
void parseForStrategy(){
  this.parsedForStrategySql.clear();
  Preconditions.checkState(this.replacedSteps.size() > 0,"String_Node_Str");
  Preconditions.checkState(this.replacedSteps.get(0).isGraphStep(),"String_Node_Str");
  Set<SchemaTableTree> rootSchemaTableTrees=this.sqlgGraph.getGremlinParser().parseForStrategy(this.replacedSteps);
  for (  SchemaTableTree rootSchemaTableTree : rootSchemaTableTrees) {
    try {
      List<Pair<LinkedList<SchemaTableTree>,String>> sqlStatements=rootSchemaTableTree.constructSql();
      this.parsedForStrategySql.put(rootSchemaTableTree,sqlStatements);
    }
  finally {
      rootSchemaTableTree.resetThreadVars();
    }
  }
  rootSchemaTableTrees.forEach(SchemaTableTree::resetThreadVars);
}
Program: 167089
Project: 167089
Buggy source:
void parseForStrategy(SqlgGraph sqlgGraph,SchemaTable schemaTable){
  this.parsedForStrategySql.clear();
  Preconditions.checkState(this.replacedSteps.size() > 0,"String_Node_Str");
  Preconditions.checkState(this.replacedSteps.get(0).isVertexStep() || this.replacedSteps.get(0).isEdgeVertexStep(),"String_Node_Str" + this.replacedSteps.get(0).getStep().getClass().toString());
  SchemaTableTree schemaTableTree=sqlgGraph.getGremlinParser().parse(schemaTable,this.replacedSteps);
  List<Pair<LinkedList<SchemaTableTree>,String>> sqlStatements=schemaTableTree.constructSql();
  try {
    this.parsedForStrategySql.put(schemaTableTree,sqlStatements);
  }
  finally {
    schemaTableTree.resetThreadVars();
  }
}

Fixed version (ground truth):
void parseForStrategy(SqlgGraph sqlgGraph,SchemaTable schemaTable){
  this.parsedForStrategySql.clear();
  Preconditions.checkState(this.replacedSteps.size() > 0,"String_Node_Str");
  Preconditions.checkState(this.replacedSteps.get(0).isVertexStep() || this.replacedSteps.get(0).isEdgeVertexStep(),"String_Node_Str" + this.replacedSteps.get(0).getStep().getClass().toString());
  SchemaTableTree schemaTableTree=null;
  try {
    schemaTableTree=sqlgGraph.getGremlinParser().parse(schemaTable,this.replacedSteps);
    List<Pair<LinkedList<SchemaTableTree>,String>> sqlStatements=schemaTableTree.constructSql();
    this.parsedForStrategySql.put(schemaTableTree,sqlStatements);
  }
  finally {
    if (schemaTableTree != null)     schemaTableTree.resetThreadVars();
  }
}