Program: 101992
Project: 101992
Buggy source:
/** 
 * Create RelationalReference objects
 * @param node the provided AstNode
 * @param model the RelationalModel being created
 * @param schema the schema
 * @return the map of AstNodes which need to be deferred
 * @throws Exception 
 */
@Override protected Map<AstNode,RelationalReference> createObject(AstNode node,RelationalModel model,RelationalSchema schema) throws Exception {
  Map<AstNode,RelationalReference> deferredMap=new HashMap<AstNode,RelationalReference>();
  if (is(node,TeiidDdlLexicon.CreateTable.TABLE_STATEMENT)) {
    RelationalTable baseTable=getFactory().createBaseTable();
    initializeTable(baseTable,node,model);
    List<AstNode> optionNodes=new ArrayList<AstNode>();
    for (    AstNode child : node) {
      if (is(child,TeiidDdlLexicon.CreateTable.TABLE_ELEMENT)) {
        createColumn(child,baseTable);
      }
 else       if (is(child,StandardDdlLexicon.TYPE_STATEMENT_OPTION)) {
        optionNodes.add(child);
      }
 else       if (is(child,TeiidDdlLexicon.Constraint.TABLE_ELEMENT) || is(child,TeiidDdlLexicon.Constraint.FOREIGN_KEY_CONSTRAINT) || is(child,TeiidDdlLexicon.Constraint.INDEX_CONSTRAINT)) {
        deferredMap.put(child,baseTable);
      }
    }
    if (!optionNodes.isEmpty()) {
      processOptions(optionNodes,baseTable);
    }
  }
 else   if (is(node,TeiidDdlLexicon.CreateTable.VIEW_STATEMENT)) {
    RelationalViewTable viewTable=getFactory().createViewTable();
    initializeTable(viewTable,node,model);
    List<AstNode> optionNodes=new ArrayList<AstNode>();
    for (    AstNode child : node) {
      if (is(child,TeiidDdlLexicon.CreateTable.TABLE_ELEMENT)) {
        createColumn(child,viewTable);
      }
 else       if (is(child,StandardDdlLexicon.TYPE_STATEMENT_OPTION)) {
        optionNodes.add(child);
      }
 else       if (is(child,TeiidDdlLexicon.Constraint.TABLE_ELEMENT) || is(child,TeiidDdlLexicon.Constraint.FOREIGN_KEY_CONSTRAINT) || is(child,TeiidDdlLexicon.Constraint.INDEX_CONSTRAINT)) {
        deferredMap.put(child,viewTable);
      }
    }
    if (!optionNodes.isEmpty()) {
      processOptions(optionNodes,viewTable);
    }
    String queryExpression=(String)node.getProperty(TeiidDdlLexicon.CreateTable.QUERY_EXPRESSION);
    if (!StringUtilities.isEmpty(queryExpression)) {
      viewTable.setTransformationSQL(queryExpression);
    }
  }
 else   if (is(node,TeiidDdlLexicon.CreateProcedure.PROCEDURE_STATEMENT) || is(node,TeiidDdlLexicon.CreateProcedure.FUNCTION_STATEMENT)) {
    createProcedure(node,model);
  }
 else   if (is(node,TeiidDdlLexicon.AlterOptions.TABLE_STATEMENT)) {
    deferredMap.put(node,null);
  }
 else   if (is(node,TeiidDdlLexicon.AlterOptions.VIEW_STATEMENT) || is(node,TeiidDdlLexicon.AlterOptions.PROCEDURE_STATEMENT)) {
  }
 else {
    return super.createObject(node,model,schema);
  }
  return deferredMap;
}

Fixed version (ground truth):
/** 
 * Create RelationalReference objects
 * @param node the provided AstNode
 * @param model the RelationalModel being created
 * @param schema the schema
 * @return the map of AstNodes which need to be deferred
 * @throws Exception 
 */
@Override protected Map<AstNode,RelationalReference> createObject(AstNode node,RelationalModel model,RelationalSchema schema) throws Exception {
  Map<AstNode,RelationalReference> deferredMap=new HashMap<AstNode,RelationalReference>();
  if (is(node,TeiidDdlLexicon.CreateTable.TABLE_STATEMENT)) {
    RelationalTable baseTable=getFactory().createBaseTable();
    initializeTable(baseTable,node,model);
    List<AstNode> optionNodes=new ArrayList<AstNode>();
    for (    AstNode child : node) {
      if (is(child,TeiidDdlLexicon.CreateTable.TABLE_ELEMENT)) {
        createColumn(child,baseTable);
      }
 else       if (is(child,StandardDdlLexicon.TYPE_STATEMENT_OPTION)) {
        optionNodes.add(child);
      }
 else       if (is(child,TeiidDdlLexicon.Constraint.TABLE_ELEMENT) || is(child,TeiidDdlLexicon.Constraint.FOREIGN_KEY_CONSTRAINT) || is(child,TeiidDdlLexicon.Constraint.INDEX_CONSTRAINT)) {
        deferredMap.put(child,baseTable);
      }
    }
    if (!optionNodes.isEmpty()) {
      processOptions(optionNodes,baseTable);
    }
  }
 else   if (is(node,TeiidDdlLexicon.CreateTable.VIEW_STATEMENT)) {
    RelationalViewTable viewTable=getFactory().createViewTable();
    initializeTable(viewTable,node,model);
    List<AstNode> optionNodes=new ArrayList<AstNode>();
    for (    AstNode child : node) {
      if (is(child,TeiidDdlLexicon.CreateTable.TABLE_ELEMENT)) {
        createColumn(child,viewTable);
      }
 else       if (is(child,StandardDdlLexicon.TYPE_STATEMENT_OPTION)) {
        optionNodes.add(child);
      }
 else       if (is(child,TeiidDdlLexicon.Constraint.TABLE_ELEMENT) || is(child,TeiidDdlLexicon.Constraint.FOREIGN_KEY_CONSTRAINT) || is(child,TeiidDdlLexicon.Constraint.INDEX_CONSTRAINT)) {
        deferredMap.put(child,viewTable);
      }
    }
    if (!optionNodes.isEmpty()) {
      processOptions(optionNodes,viewTable);
    }
    String queryExpression=(String)node.getProperty(TeiidDdlLexicon.CreateTable.QUERY_EXPRESSION);
    if (!StringUtilities.isEmpty(queryExpression)) {
      viewTable.setTransformationSQL(queryExpression);
    }
  }
 else   if (is(node,TeiidDdlLexicon.CreateProcedure.PROCEDURE_STATEMENT) || is(node,TeiidDdlLexicon.CreateProcedure.FUNCTION_STATEMENT)) {
    String modelType=(String)node.getProperty(TeiidDdlLexicon.SchemaElement.TYPE);
    if (modelType != null) {
      if (modelType.equalsIgnoreCase("String_Node_Str")) {
        createVirtualProcedure(node,model);
      }
 else {
        createProcedure(node,model);
      }
    }
  }
 else   if (is(node,TeiidDdlLexicon.AlterOptions.TABLE_STATEMENT)) {
    deferredMap.put(node,null);
  }
 else   if (is(node,TeiidDdlLexicon.AlterOptions.VIEW_STATEMENT) || is(node,TeiidDdlLexicon.AlterOptions.PROCEDURE_STATEMENT)) {
  }
 else {
    return super.createObject(node,model,schema);
  }
  return deferredMap;
}