Program: 167130
Project: 167130
Buggy source:
private Iterator<SqlgVertex> internalGetVertices(List<HasContainer> hasContainers,Direction direction,String... labels){
  if (this.sqlG.features().supportsBatchMode() && this.sqlG.tx().isInBatchMode() && this.sqlG.tx().getBatchManager().vertexIsCached(this)) {
    List<SqlgVertex> vertices=this.sqlG.tx().getBatchManager().getVertices(this,direction,labels);
    return vertices.stream().filter(v -> HasContainer.testAll(v,hasContainers)).iterator();
  }
 else {
    List<SqlgVertex> vertices=new ArrayList<>();
    List<HasContainer> labelHasContainers=filterHasContainerOnKey(hasContainers,T.label.getAccessor());
    Set<String> hasContainerLabels=extractLabelsFromHasContainer(labelHasContainers);
    List<Direction> directions=new ArrayList<>(2);
    Set<SchemaTable> inVertexLabels=new HashSet<>();
    Set<SchemaTable> outVertexLabels=new HashSet<>();
    if (direction == Direction.IN) {
      inVertexLabels.addAll(this.sqlG.getSchemaManager().getLabelsForVertex(this,true));
      if (labels.length > 0) {
        retainLabels(inVertexLabels,labels);
      }
      directions.add(direction);
    }
 else     if (direction == Direction.OUT) {
      outVertexLabels.addAll(this.sqlG.getSchemaManager().getLabelsForVertex(this,false));
      if (labels.length > 0) {
        retainLabels(outVertexLabels,labels);
      }
      directions.add(direction);
    }
 else {
      inVertexLabels.addAll(this.sqlG.getSchemaManager().getLabelsForVertex(this,true));
      outVertexLabels.addAll(this.sqlG.getSchemaManager().getLabelsForVertex(this,false));
      if (labels.length > 0) {
        retainLabels(inVertexLabels,labels);
        retainLabels(outVertexLabels,labels);
      }
      directions.add(Direction.IN);
      directions.add(Direction.OUT);
    }
    for (    Direction d : directions) {
      for (      SchemaTable schemaTable : (d == Direction.IN ? inVertexLabels : outVertexLabels)) {
        if (this.sqlG.getSchemaManager().tableExist(schemaTable.getSchema(),SchemaManager.EDGE_PREFIX + schemaTable.getTable())) {
          Set<String> edgeForeignKeys=this.sqlG.getSchemaManager().getEdgeForeignKeys(schemaTable.getSchema() + "String_Node_Str" + SchemaManager.EDGE_PREFIX+ schemaTable.getTable());
          Set<SchemaTable> tables;
switch (d) {
case IN:
            tables=transformToOutSchemaTables(edgeForeignKeys,hasContainerLabels);
          break;
case OUT:
        tables=transformToInSchemaTables(edgeForeignKeys,hasContainerLabels);
      break;
default :
    throw new IllegalStateException("String_Node_Str");
}
for (SchemaTable joinSchemaTable : tables) {
  StringBuilder sql=new StringBuilder("String_Node_Str");
  sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
  sql.append("String_Node_Str");
  sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
  sql.append("String_Node_Str");
  sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
  sql.append("String_Node_Str");
  sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
  sql.append("String_Node_Str");
switch (d) {
case IN:
    sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema() + "String_Node_Str" + joinSchemaTable.getTable()+ SchemaManager.OUT_VERTEX_COLUMN_END));
  sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema() + "String_Node_Str" + joinSchemaTable.getTable()+ SchemaManager.OUT_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(this.schema + "String_Node_Str" + this.table+ SchemaManager.IN_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
for (HasContainer hasContainer : hasContainers) {
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(this.sqlG.getSqlDialect().hasContainerKeyToColumn(hasContainer.key)));
if (!hasContainer.predicate.equals(Compare.eq)) {
throw new IllegalStateException("String_Node_Str");
}
sql.append("String_Node_Str");
}
break;
case OUT:
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema() + "String_Node_Str" + joinSchemaTable.getTable()+ SchemaManager.IN_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema() + "String_Node_Str" + joinSchemaTable.getTable()+ SchemaManager.IN_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(this.schema + "String_Node_Str" + this.table+ SchemaManager.OUT_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
for (HasContainer hasContainer : hasContainers) {
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(this.sqlG.getSqlDialect().hasContainerKeyToColumn(hasContainer.key)));
if (!hasContainer.predicate.equals(Compare.eq)) {
throw new IllegalStateException("String_Node_Str");
}
sql.append("String_Node_Str");
}
break;
default :
throw new IllegalStateException("String_Node_Str");
}
if (this.sqlG.getSqlDialect().needsSemicolon()) {
sql.append("String_Node_Str");
}
Connection conn=this.sqlG.tx().getConnection();
if (logger.isDebugEnabled()) {
logger.debug(sql.toString());
}
try (PreparedStatement preparedStatement=conn.prepareStatement(sql.toString())){
switch (d) {
case IN:
preparedStatement.setLong(1,this.primaryKey);
break;
case OUT:
preparedStatement.setLong(1,this.primaryKey);
break;
case BOTH:
throw new IllegalStateException("String_Node_Str");
}
int countHasContainers=2;
for (HasContainer hasContainer : hasContainers) {
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(hasContainer.key));
if (!hasContainer.predicate.equals(Compare.eq)) {
throw new IllegalStateException("String_Node_Str");
}
Map<String,Object> keyValues=new HashMap<>();
keyValues.put(hasContainer.key,hasContainer.value);
SqlgElement.setKeyValuesAsParameter(this.sqlG,countHasContainers++,conn,preparedStatement,keyValues);
}
ResultSet resultSet=preparedStatement.executeQuery();
while (resultSet.next()) {
Set<String> inVertexColumnNames=new HashSet<>();
Set<String> outVertexColumnNames=new HashSet<>();
String inVertexColumnName="String_Node_Str";
String outVertexColumnName="String_Node_Str";
ResultSetMetaData resultSetMetaData=resultSet.getMetaData();
for (int i=1; i <= resultSetMetaData.getColumnCount(); i++) {
String columnName=resultSetMetaData.getColumnName(i);
if (columnName.endsWith(SchemaManager.IN_VERTEX_COLUMN_END)) {
inVertexColumnNames.add(columnName);
}
 else if (columnName.endsWith(SchemaManager.OUT_VERTEX_COLUMN_END)) {
outVertexColumnNames.add(columnName);
}
}
if (inVertexColumnNames.isEmpty() && outVertexColumnNames.isEmpty()) {
throw new IllegalStateException("String_Node_Str");
}
Long inId=null;
Long outId=null;
for (String inColumnName : inVertexColumnNames) {
if (inId != null) {
resultSet.getLong(inColumnName);
if (!resultSet.wasNull()) {
throw new IllegalStateException("String_Node_Str");
}
}
 else {
Long tempInId=resultSet.getLong(inColumnName);
if (!resultSet.wasNull()) {
inId=tempInId;
inVertexColumnName=inColumnName;
}
}
}
for (String outColumnName : outVertexColumnNames) {
if (outId != null) {
resultSet.getLong(outColumnName);
if (!resultSet.wasNull()) {
throw new IllegalStateException("String_Node_Str");
}
}
 else {
Long tempOutId=resultSet.getLong(outColumnName);
if (!resultSet.wasNull()) {
outId=tempOutId;
outVertexColumnName=outColumnName;
}
}
}
if (inVertexColumnName.isEmpty() && outVertexColumnName.isEmpty()) {
throw new IllegalStateException("String_Node_Str");
}
List<Object> keyValues=new ArrayList<>();
for (int i=1; i <= resultSetMetaData.getColumnCount(); i++) {
String columnName=resultSetMetaData.getColumnName(i);
if (!(columnName.equals("String_Node_Str") || inVertexColumnNames.contains(columnName) || outVertexColumnNames.contains(columnName))) {
keyValues.add(columnName);
keyValues.add(resultSet.getObject(columnName));
}
}
SqlgVertex sqlGVertex=null;
switch (d) {
case IN:
sqlGVertex=SqlgVertex.of(this.sqlG,outId,joinSchemaTable.getSchema(),joinSchemaTable.getTable());
Map<String,Object> keyValueMap=SqlgUtil.transformToInsertValues(keyValues);
this.properties.clear();
this.properties.putAll(keyValueMap);
break;
case OUT:
sqlGVertex=SqlgVertex.of(this.sqlG,inId,joinSchemaTable.getSchema(),joinSchemaTable.getTable());
keyValueMap=SqlgUtil.transformToInsertValues(keyValues);
this.properties.clear();
this.properties.putAll(keyValueMap);
break;
case BOTH:
throw new IllegalStateException("String_Node_Str");
}
vertices.add(sqlGVertex);
}
}
 catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
}
}
return vertices.iterator();
}
}

Fixed version (ground truth):
private Iterator<SqlgVertex> internalGetVertices(List<HasContainer> hasContainers,Direction direction,String... labels){
  if (this.sqlG.features().supportsBatchMode() && this.sqlG.tx().isInBatchMode() && this.sqlG.tx().getBatchManager().vertexIsCached(this)) {
    List<SqlgVertex> vertices=this.sqlG.tx().getBatchManager().getVertices(this,direction,labels);
    return vertices.stream().filter(v -> HasContainer.testAll(v,hasContainers)).iterator();
  }
 else {
    List<SqlgVertex> vertices=new ArrayList<>();
    List<HasContainer> labelHasContainers=filterHasContainerOnKey(hasContainers,T.label.getAccessor());
    Set<String> hasContainerLabels=extractLabelsFromHasContainer(labelHasContainers);
    List<Direction> directions=new ArrayList<>(2);
    Set<SchemaTable> inVertexLabels=new HashSet<>();
    Set<SchemaTable> outVertexLabels=new HashSet<>();
    if (direction == Direction.IN) {
      inVertexLabels.addAll(this.sqlG.getSchemaManager().getLabelsForVertex(this,true));
      if (labels.length > 0) {
        retainLabels(inVertexLabels,labels);
      }
      directions.add(direction);
    }
 else     if (direction == Direction.OUT) {
      outVertexLabels.addAll(this.sqlG.getSchemaManager().getLabelsForVertex(this,false));
      if (labels.length > 0) {
        retainLabels(outVertexLabels,labels);
      }
      directions.add(direction);
    }
 else {
      inVertexLabels.addAll(this.sqlG.getSchemaManager().getLabelsForVertex(this,true));
      outVertexLabels.addAll(this.sqlG.getSchemaManager().getLabelsForVertex(this,false));
      if (labels.length > 0) {
        retainLabels(inVertexLabels,labels);
        retainLabels(outVertexLabels,labels);
      }
      directions.add(Direction.IN);
      directions.add(Direction.OUT);
    }
    for (    Direction d : directions) {
      for (      SchemaTable schemaTable : (d == Direction.IN ? inVertexLabels : outVertexLabels)) {
        if (this.sqlG.getSchemaManager().tableExist(schemaTable.getSchema(),SchemaManager.EDGE_PREFIX + schemaTable.getTable())) {
          Set<String> edgeForeignKeys=this.sqlG.getSchemaManager().getEdgeForeignKeys(schemaTable.getSchema() + "String_Node_Str" + SchemaManager.EDGE_PREFIX+ schemaTable.getTable());
          Set<SchemaTable> tables;
switch (d) {
case IN:
            tables=transformToOutSchemaTables(edgeForeignKeys,hasContainerLabels);
          break;
case OUT:
        tables=transformToInSchemaTables(edgeForeignKeys,hasContainerLabels);
      break;
default :
    throw new IllegalStateException("String_Node_Str");
}
for (SchemaTable joinSchemaTable : tables) {
  StringBuilder sql=new StringBuilder("String_Node_Str");
  sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
  sql.append("String_Node_Str");
  sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
  sql.append("String_Node_Str");
  sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
  sql.append("String_Node_Str");
  sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
  sql.append("String_Node_Str");
switch (d) {
case IN:
    sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema() + "String_Node_Str" + joinSchemaTable.getTable()+ SchemaManager.OUT_VERTEX_COLUMN_END));
  sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema() + "String_Node_Str" + joinSchemaTable.getTable()+ SchemaManager.OUT_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(this.schema + "String_Node_Str" + this.table+ SchemaManager.IN_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
for (HasContainer hasContainer : hasContainers) {
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(this.sqlG.getSqlDialect().hasContainerKeyToColumn(hasContainer.key)));
if (!hasContainer.predicate.equals(Compare.eq)) {
throw new IllegalStateException("String_Node_Str");
}
sql.append("String_Node_Str");
}
break;
case OUT:
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema() + "String_Node_Str" + joinSchemaTable.getTable()+ SchemaManager.IN_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.EDGE_PREFIX + schemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema() + "String_Node_Str" + joinSchemaTable.getTable()+ SchemaManager.IN_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(this.schema + "String_Node_Str" + this.table+ SchemaManager.OUT_VERTEX_COLUMN_END));
sql.append("String_Node_Str");
for (HasContainer hasContainer : hasContainers) {
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(joinSchemaTable.getSchema()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTEX_PREFIX + joinSchemaTable.getTable()));
sql.append("String_Node_Str");
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(this.sqlG.getSqlDialect().hasContainerKeyToColumn(hasContainer.key)));
if (!hasContainer.predicate.equals(Compare.eq)) {
throw new IllegalStateException("String_Node_Str");
}
sql.append("String_Node_Str");
}
break;
default :
throw new IllegalStateException("String_Node_Str");
}
if (this.sqlG.getSqlDialect().needsSemicolon()) {
sql.append("String_Node_Str");
}
Connection conn=this.sqlG.tx().getConnection();
if (logger.isDebugEnabled()) {
logger.debug(sql.toString());
}
try (PreparedStatement preparedStatement=conn.prepareStatement(sql.toString())){
switch (d) {
case IN:
preparedStatement.setLong(1,this.primaryKey);
break;
case OUT:
preparedStatement.setLong(1,this.primaryKey);
break;
case BOTH:
throw new IllegalStateException("String_Node_Str");
}
int countHasContainers=2;
for (HasContainer hasContainer : hasContainers) {
sql.append(this.sqlG.getSqlDialect().maybeWrapInQoutes(hasContainer.key));
if (!hasContainer.predicate.equals(Compare.eq)) {
throw new IllegalStateException("String_Node_Str");
}
Map<String,Object> keyValues=new HashMap<>();
keyValues.put(hasContainer.key,hasContainer.value);
SqlgElement.setKeyValuesAsParameter(this.sqlG,countHasContainers++,conn,preparedStatement,keyValues);
}
ResultSet resultSet=preparedStatement.executeQuery();
while (resultSet.next()) {
Set<String> inVertexColumnNames=new HashSet<>();
Set<String> outVertexColumnNames=new HashSet<>();
String inVertexColumnName="String_Node_Str";
String outVertexColumnName="String_Node_Str";
ResultSetMetaData resultSetMetaData=resultSet.getMetaData();
for (int i=1; i <= resultSetMetaData.getColumnCount(); i++) {
String columnName=resultSetMetaData.getColumnName(i);
if (columnName.endsWith(SchemaManager.IN_VERTEX_COLUMN_END)) {
inVertexColumnNames.add(columnName);
}
 else if (columnName.endsWith(SchemaManager.OUT_VERTEX_COLUMN_END)) {
outVertexColumnNames.add(columnName);
}
}
if (inVertexColumnNames.isEmpty() && outVertexColumnNames.isEmpty()) {
throw new IllegalStateException("String_Node_Str");
}
Long inId=null;
Long outId=null;
for (String inColumnName : inVertexColumnNames) {
if (inId != null) {
resultSet.getLong(inColumnName);
if (!resultSet.wasNull()) {
throw new IllegalStateException("String_Node_Str");
}
}
 else {
Long tempInId=resultSet.getLong(inColumnName);
if (!resultSet.wasNull()) {
inId=tempInId;
inVertexColumnName=inColumnName;
}
}
}
for (String outColumnName : outVertexColumnNames) {
if (outId != null) {
resultSet.getLong(outColumnName);
if (!resultSet.wasNull()) {
throw new IllegalStateException("String_Node_Str");
}
}
 else {
Long tempOutId=resultSet.getLong(outColumnName);
if (!resultSet.wasNull()) {
outId=tempOutId;
outVertexColumnName=outColumnName;
}
}
}
if (inVertexColumnName.isEmpty() && outVertexColumnName.isEmpty()) {
throw new IllegalStateException("String_Node_Str");
}
List<Object> keyValues=new ArrayList<>();
for (int i=1; i <= resultSetMetaData.getColumnCount(); i++) {
String columnName=resultSetMetaData.getColumnName(i);
if (!(columnName.equals("String_Node_Str") || inVertexColumnNames.contains(columnName) || outVertexColumnNames.contains(columnName))) {
keyValues.add(columnName);
keyValues.add(resultSet.getObject(columnName));
}
}
SqlgVertex sqlGVertex=null;
switch (d) {
case IN:
sqlGVertex=SqlgVertex.of(this.sqlG,outId,joinSchemaTable.getSchema(),joinSchemaTable.getTable());
Map<String,Object> keyValueMap=SqlgUtil.transformToInsertValues(keyValues.toArray());
sqlGVertex.properties.clear();
sqlGVertex.properties.putAll(keyValueMap);
break;
case OUT:
sqlGVertex=SqlgVertex.of(this.sqlG,inId,joinSchemaTable.getSchema(),joinSchemaTable.getTable());
keyValueMap=SqlgUtil.transformToInsertValues(keyValues.toArray());
sqlGVertex.properties.clear();
sqlGVertex.properties.putAll(keyValueMap);
sqlGVertex=new SqlgVertex(this.sqlG,inId,joinSchemaTable.getSchema(),joinSchemaTable.getTable(),keyValues.toArray());
break;
case BOTH:
throw new IllegalStateException("String_Node_Str");
}
vertices.add(sqlGVertex);
}
}
 catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
}
}
return vertices.iterator();
}
}