Program: 167016
Project: 167016
Buggy source:
/** 
 * This is only called for local vertex steps. Constructs the label paths from the given schemaTable to the leaf vertex labels for the gremlin query. For each path Sqlg will executeRegularQuery a sql query. The union of the queries is the result the gremlin query. The vertex labels can be calculated from the steps.
 * @param schemaTable
 * @param replacedSteps The original VertexSteps and HasSteps that were replaced
 * @return a List of paths. Each path is itself a list of SchemaTables.
 */
public SchemaTableTree parse(SchemaTable schemaTable,List<ReplacedStep<S,E>> replacedSteps){
  if (replacedSteps.get(0).isGraphStep()) {
    throw new IllegalStateException("String_Node_Str");
  }
 else {
    Set<SchemaTableTree> schemaTableTrees=new HashSet<>();
    SchemaTableTree rootSchemaTableTree=new SchemaTableTree(this.sqlgGraph,schemaTable,0,replacedSteps.size() - 1);
    rootSchemaTableTree.setOptionalLeftJoin(replacedSteps.get(0).isLeftJoin());
    rootSchemaTableTree.setEmit(replacedSteps.get(0).isEmit());
    rootSchemaTableTree.setUntilFirst(replacedSteps.get(0).isUntilFirst());
    rootSchemaTableTree.initializeAliasColumnNameMaps();
    rootSchemaTableTree.setStepType(schemaTable.isVertexTable() ? SchemaTableTree.STEP_TYPE.VERTEX_STEP : SchemaTableTree.STEP_TYPE.EDGE_VERTEX_STEP);
    schemaTableTrees.add(rootSchemaTableTree);
    for (    ReplacedStep<S,E> replacedStep : replacedSteps) {
      if (!replacedStep.isFake()) {
        schemaTableTrees=replacedStep.calculatePathForStep(schemaTableTrees);
      }
    }
    rootSchemaTableTree.removeAllButDeepestLeafNodes(replacedSteps.size() - 1);
    rootSchemaTableTree.removeNodesInvalidatedByHas();
    rootSchemaTableTree.setLocalStep(true);
    return rootSchemaTableTree;
  }
}

Fixed version (ground truth):
/** 
 * This is only called for local vertex steps. Constructs the label paths from the given schemaTable to the leaf vertex labels for the gremlin query. For each path Sqlg will executeRegularQuery a sql query. The union of the queries is the result the gremlin query. The vertex labels can be calculated from the steps.
 * @param schemaTable
 * @param replacedSteps The original VertexSteps and HasSteps that were replaced
 * @return a List of paths. Each path is itself a list of SchemaTables.
 */
public SchemaTableTree parse(SchemaTable schemaTable,List<ReplacedStep<S,E>> replacedSteps){
  Preconditions.checkArgument(!replacedSteps.get(0).isGraphStep(),"String_Node_Str");
  Set<SchemaTableTree> schemaTableTrees=new HashSet<>();
  SchemaTableTree rootSchemaTableTree=new SchemaTableTree(this.sqlgGraph,schemaTable,0,replacedSteps.size() - 1);
  rootSchemaTableTree.setOptionalLeftJoin(replacedSteps.get(0).isLeftJoin());
  rootSchemaTableTree.setEmit(replacedSteps.get(0).isEmit());
  rootSchemaTableTree.setUntilFirst(replacedSteps.get(0).isUntilFirst());
  rootSchemaTableTree.initializeAliasColumnNameMaps();
  rootSchemaTableTree.setStepType(schemaTable.isVertexTable() ? SchemaTableTree.STEP_TYPE.VERTEX_STEP : SchemaTableTree.STEP_TYPE.EDGE_VERTEX_STEP);
  schemaTableTrees.add(rootSchemaTableTree);
  for (  ReplacedStep<S,E> replacedStep : replacedSteps) {
    if (!replacedStep.isFake()) {
      schemaTableTrees=replacedStep.calculatePathForStep(schemaTableTrees);
    }
  }
  rootSchemaTableTree.removeNodesInvalidatedByHas();
  rootSchemaTableTree.removeAllButDeepestAndAddCacheLeafNodes(replacedSteps.size() - 1);
  rootSchemaTableTree.setLocalStep(true);
  return rootSchemaTableTree;
}