Program: 95990
Project: 95990
Buggy source:
@Test public void IncompleteQuery15Test() throws VerdictDBException, SQLException {
  RelationStandardizer.resetItemID();
  String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  AbstractRelation relation=sqlToRelation.toRelation(sql);
  RelationStandardizer gen=new RelationStandardizer(staticMetaData);
  relation=gen.standardize((SelectQuery)relation);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan("String_Node_Str",meta,(SelectQuery)relation);
  queryExecutionPlan.cleanUp();
  assertEquals(2,queryExecutionPlan.root.dependents.get(0).dependents.size());
  SelectQuery expected=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new ColumnOp("String_Node_Str",new BaseColumn("String_Node_Str","String_Node_Str")),"String_Node_Str"),new AliasedColumn(new BaseColumn("String_Node_Str","String_Node_Str"),"String_Node_Str")),Arrays.<AbstractRelation>asList(new BaseTable("String_Node_Str","String_Node_Str","String_Node_Str"),new BaseTable(placeholderSchemaName,placeholderTableName,"String_Node_Str"),new BaseTable(placeholderSchemaName,placeholderTableName,"String_Node_Str")));
  assertEquals(expected.getFromList(),((CreateTableAsSelectNode)queryExecutionPlan.root.dependents.get(0)).getSelectQuery().getFromList());
  SelectQuery revenue_cached=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new BaseColumn("String_Node_Str","String_Node_Str"),"String_Node_Str"),new AliasedColumn(new ColumnOp("String_Node_Str",new ColumnOp("String_Node_Str",Arrays.asList(new BaseColumn("String_Node_Str","String_Node_Str"),new ColumnOp("String_Node_Str",Arrays.asList(ConstantColumn.valueOf(1),new BaseColumn("String_Node_Str","String_Node_Str")))))),"String_Node_Str")),new BaseTable("String_Node_Str","String_Node_Str","String_Node_Str"));
  revenue_cached.addFilterByAnd(new ColumnOp("String_Node_Str",Arrays.asList(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf("String_Node_Str"))));
  revenue_cached.addFilterByAnd(new ColumnOp("String_Node_Str",Arrays.asList(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf("String_Node_Str"))));
  revenue_cached.addGroupby(new AliasReference("String_Node_Str"));
  revenue_cached.setAliasName("String_Node_Str");
  assertEquals(revenue_cached,((CreateTableAsSelectNode)queryExecutionPlan.root.dependents.get(0).dependents.get(0)).selectQuery);
  SelectQuery max_revenue_cached=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new ColumnOp("String_Node_Str",new BaseColumn("String_Node_Str","String_Node_Str")),"String_Node_Str")),new BaseTable(placeholderSchemaName,placeholderTableName,"String_Node_Str"));
  max_revenue_cached.setAliasName("String_Node_Str");
  assertEquals(max_revenue_cached,((CreateTableAsSelectNode)queryExecutionPlan.root.dependents.get(0).dependents.get(1)).selectQuery);
  stmt.execute("String_Node_Str");
  ExecutablePlanRunner.runTillEnd(new JdbcConnection(conn,new H2Syntax()),queryExecutionPlan);
  stmt.execute("String_Node_Str");
}

Fixed version (ground truth):
public void IncompleteQuery15Test() throws VerdictDBException, SQLException {
  RelationStandardizer.resetItemID();
  String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  AbstractRelation relation=sqlToRelation.toRelation(sql);
  RelationStandardizer gen=new RelationStandardizer(staticMetaData);
  relation=gen.standardize((SelectQuery)relation);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan("String_Node_Str",meta,(SelectQuery)relation);
  queryExecutionPlan.cleanUp();
  assertEquals(2,queryExecutionPlan.root.dependents.get(0).dependents.size());
  SelectQuery expected=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new ColumnOp("String_Node_Str",new BaseColumn("String_Node_Str","String_Node_Str")),"String_Node_Str"),new AliasedColumn(new BaseColumn("String_Node_Str","String_Node_Str"),"String_Node_Str")),Arrays.<AbstractRelation>asList(new BaseTable("String_Node_Str","String_Node_Str","String_Node_Str"),new BaseTable(placeholderSchemaName,placeholderTableName,"String_Node_Str"),new BaseTable(placeholderSchemaName,placeholderTableName,"String_Node_Str")));
  assertEquals(expected.getFromList(),((CreateTableAsSelectNode)queryExecutionPlan.root.dependents.get(0)).getSelectQuery().getFromList());
  SelectQuery revenue_cached=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new BaseColumn("String_Node_Str","String_Node_Str"),"String_Node_Str"),new AliasedColumn(new ColumnOp("String_Node_Str",new ColumnOp("String_Node_Str",Arrays.asList(new BaseColumn("String_Node_Str","String_Node_Str"),new ColumnOp("String_Node_Str",Arrays.asList(ConstantColumn.valueOf(1),new BaseColumn("String_Node_Str","String_Node_Str")))))),"String_Node_Str")),new BaseTable("String_Node_Str","String_Node_Str","String_Node_Str"));
  revenue_cached.addFilterByAnd(new ColumnOp("String_Node_Str",Arrays.asList(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf("String_Node_Str"))));
  revenue_cached.addFilterByAnd(new ColumnOp("String_Node_Str",Arrays.asList(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf("String_Node_Str"))));
  revenue_cached.addGroupby(new AliasReference("String_Node_Str"));
  revenue_cached.setAliasName("String_Node_Str");
  assertEquals(revenue_cached,((CreateTableAsSelectNode)queryExecutionPlan.root.dependents.get(0).dependents.get(0)).selectQuery);
  SelectQuery max_revenue_cached=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new ColumnOp("String_Node_Str",new BaseColumn("String_Node_Str","String_Node_Str")),"String_Node_Str")),new BaseTable(placeholderSchemaName,placeholderTableName,"String_Node_Str"));
  max_revenue_cached.setAliasName("String_Node_Str");
  assertEquals(max_revenue_cached,((CreateTableAsSelectNode)queryExecutionPlan.root.dependents.get(0).dependents.get(1)).selectQuery);
  stmt.execute("String_Node_Str");
  ExecutablePlanRunner.runTillEnd(new JdbcConnection(conn,new H2Syntax()),queryExecutionPlan);
  stmt.execute("String_Node_Str");
}