Program: 95985
Project: 95985
Buggy source:
@Test public void SubqueryInFilterMultiplePredicateTest() throws VerdictDBException, SQLException {
  RelationStandardizer.resetItemID();
  String sql="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();
  String alias=((CreateTableAsSelectNode)(queryExecutionPlan.root.dependents.get(0))).getPlaceholderTables().get(0).getAliasName().get();
  SelectQuery rewritten1=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new BaseColumn(placeholderSchemaName,alias,"String_Node_Str"),"String_Node_Str")),new BaseTable(placeholderSchemaName,placeholderTableName,alias));
  assertEquals(rewritten1,((SubqueryColumn)((ColumnOp)((ColumnOp)queryExecutionPlan.root.dependents.get(0).selectQuery.getFilter().get()).getOperand(0)).getOperand(1)).getSubquery());
  alias=((CreateTableAsSelectNode)(queryExecutionPlan.root.dependents.get(0))).getPlaceholderTables().get(1).getAliasName().get();
  SelectQuery rewritten2=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new BaseColumn(placeholderSchemaName,alias,"String_Node_Str"),"String_Node_Str")),new BaseTable(placeholderSchemaName,placeholderTableName,alias));
  assertEquals(rewritten2,((SubqueryColumn)((ColumnOp)((ColumnOp)queryExecutionPlan.root.dependents.get(0).selectQuery.getFilter().get()).getOperand(1)).getOperand(1)).getSubquery());
  stmt.execute("String_Node_Str");
  ExecutablePlanRunner.runTillEnd(new JdbcConnection(conn,new H2Syntax()),queryExecutionPlan);
  stmt.execute("String_Node_Str");
}

Fixed version (ground truth):
public void SubqueryInFilterMultiplePredicateTest() throws VerdictDBException, SQLException {
  RelationStandardizer.resetItemID();
  String sql="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();
  String alias=((CreateTableAsSelectNode)(queryExecutionPlan.root.dependents.get(0))).getPlaceholderTables().get(0).getAliasName().get();
  SelectQuery rewritten1=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new BaseColumn(placeholderSchemaName,alias,"String_Node_Str"),"String_Node_Str")),new BaseTable(placeholderSchemaName,placeholderTableName,alias));
  assertEquals(rewritten1,((SubqueryColumn)((ColumnOp)((ColumnOp)queryExecutionPlan.root.dependents.get(0).selectQuery.getFilter().get()).getOperand(0)).getOperand(1)).getSubquery());
  alias=((CreateTableAsSelectNode)(queryExecutionPlan.root.dependents.get(0))).getPlaceholderTables().get(1).getAliasName().get();
  SelectQuery rewritten2=SelectQuery.create(Arrays.<SelectItem>asList(new AliasedColumn(new BaseColumn(placeholderSchemaName,alias,"String_Node_Str"),"String_Node_Str")),new BaseTable(placeholderSchemaName,placeholderTableName,alias));
  assertEquals(rewritten2,((SubqueryColumn)((ColumnOp)((ColumnOp)queryExecutionPlan.root.dependents.get(0).selectQuery.getFilter().get()).getOperand(1)).getOperand(1)).getSubquery());
  stmt.execute("String_Node_Str");
  ExecutablePlanRunner.runTillEnd(new JdbcConnection(conn,new H2Syntax()),queryExecutionPlan);
  stmt.execute("String_Node_Str");
}