Program: 5490
Project: 5490
Buggy source:
private void testCreateAddAlterDrop(@Nullable String dbName,@Nullable String tableName) throws Exception {
  DatasetId datasetInstanceId=NAMESPACE_ID.dataset("String_Node_Str");
  String hiveTableName=getDatasetHiveName(datasetInstanceId);
  String showTablesCommand="String_Node_Str";
  FileSetProperties.Builder props=FileSetProperties.builder().setBasePath("String_Node_Str").setEnableExploreOnCreate(true).setSerDe("String_Node_Str").setExploreInputFormat("String_Node_Str").setExploreOutputFormat("String_Node_Str").setTableProperty("String_Node_Str",SCHEMA.toString());
  if (tableName != null) {
    props.setExploreTableName(tableName);
    hiveTableName=tableName;
  }
  String queryTableName=hiveTableName;
  if (dbName != null) {
    props.setExploreDatabaseName(dbName);
    runCommand(NAMESPACE_ID,"String_Node_Str" + dbName,false,null,null);
    showTablesCommand+="String_Node_Str" + dbName;
    queryTableName=dbName + "String_Node_Str" + queryTableName;
  }
  datasetFramework.addInstance("String_Node_Str",datasetInstanceId,props.build());
  runCommand(NAMESPACE_ID,showTablesCommand,true,null,Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList(hiveTableName))));
  FileSet fileSet=datasetFramework.getDataset(datasetInstanceId,DatasetDefinition.NO_ARGUMENTS,null);
  Assert.assertNotNull(fileSet);
  FileWriterHelper.generateAvroFile(fileSet.getLocation("String_Node_Str").getOutputStream(),"String_Node_Str",0,3);
  runCommand(NAMESPACE_ID,"String_Node_Str" + queryTableName,true,Lists.newArrayList(new ColumnDesc(hiveTableName + "String_Node_Str","String_Node_Str",1,null),new ColumnDesc(hiveTableName + "String_Node_Str","String_Node_Str",2,null)),Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList("String_Node_Str","String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str","String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str","String_Node_Str"))));
  FileWriterHelper.generateAvroFile(fileSet.getLocation("String_Node_Str").getOutputStream(),"String_Node_Str",3,5);
  runCommand(NAMESPACE_ID,"String_Node_Str" + queryTableName,true,Lists.newArrayList(new ColumnDesc("String_Node_Str","String_Node_Str",1,null)),Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList(5L))));
  datasetFramework.updateInstance(datasetInstanceId,props.setEnableExploreOnCreate(false).build());
  runCommand(NAMESPACE_ID,showTablesCommand,false,null,Collections.<QueryResult>emptyList());
  datasetFramework.updateInstance(datasetInstanceId,props.setEnableExploreOnCreate(true).build());
  runCommand(NAMESPACE_ID,"String_Node_Str" + queryTableName,true,Lists.newArrayList(new ColumnDesc("String_Node_Str","String_Node_Str",1,null)),Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList(5L))));
  datasetFramework.updateInstance(datasetInstanceId,props.setTableProperty("String_Node_Str",K_SCHEMA.toString()).build());
  runCommand(NAMESPACE_ID,"String_Node_Str" + queryTableName,true,Lists.newArrayList(new ColumnDesc(hiveTableName + "String_Node_Str","String_Node_Str",1,null)),Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList("String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str"))));
  datasetFramework.deleteInstance(datasetInstanceId);
  runCommand(NAMESPACE_ID,showTablesCommand,false,null,Collections.<QueryResult>emptyList());
  if (dbName != null) {
    runCommand(NAMESPACE_ID,"String_Node_Str" + dbName,false,null,null);
  }
}

Fixed version (ground truth):
private void testCreateAddAlterDrop(@Nullable String dbName,@Nullable String tableName) throws Exception {
  DatasetId datasetInstanceId=NAMESPACE_ID.dataset("String_Node_Str");
  String hiveTableName=getDatasetHiveName(datasetInstanceId);
  String showTablesCommand="String_Node_Str";
  FileSetProperties.Builder props=FileSetProperties.builder().setBasePath("String_Node_Str").setEnableExploreOnCreate(true).setSerDe("String_Node_Str").setExploreInputFormat("String_Node_Str").setExploreOutputFormat("String_Node_Str").setTableProperty("String_Node_Str",SCHEMA.toString());
  if (tableName != null) {
    props.setExploreTableName(tableName);
    hiveTableName=tableName;
  }
  String queryTableName=hiveTableName;
  if (dbName != null) {
    props.setExploreDatabaseName(dbName);
    runCommand(NAMESPACE_ID,"String_Node_Str" + dbName,false,null,null);
    showTablesCommand+="String_Node_Str" + dbName;
    queryTableName=dbName + "String_Node_Str" + queryTableName;
  }
  datasetFramework.addInstance("String_Node_Str",datasetInstanceId,props.build());
  runCommand(NAMESPACE_ID,showTablesCommand,true,null,Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList(hiveTableName))));
  FileSet fileSet=datasetFramework.getDataset(datasetInstanceId,DatasetDefinition.NO_ARGUMENTS,null);
  Assert.assertNotNull(fileSet);
  FileWriterHelper.generateAvroFile(fileSet.getLocation("String_Node_Str").getOutputStream(),"String_Node_Str",0,3);
  runCommand(NAMESPACE_ID,"String_Node_Str" + queryTableName,true,Lists.newArrayList(new ColumnDesc(hiveTableName + "String_Node_Str","String_Node_Str",1,null),new ColumnDesc(hiveTableName + "String_Node_Str","String_Node_Str",2,null)),Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList("String_Node_Str","String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str","String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str","String_Node_Str"))));
  FileWriterHelper.generateAvroFile(fileSet.getLocation("String_Node_Str").getOutputStream(),"String_Node_Str",3,5);
  runCommand(NAMESPACE_ID,"String_Node_Str" + queryTableName,true,Lists.newArrayList(new ColumnDesc("String_Node_Str","String_Node_Str",1,null)),Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList(5L))));
  datasetFramework.updateInstance(datasetInstanceId,props.setEnableExploreOnCreate(false).build());
  runCommand(NAMESPACE_ID,showTablesCommand,false,null,Collections.<QueryResult>emptyList());
  datasetFramework.updateInstance(datasetInstanceId,props.setEnableExploreOnCreate(true).build());
  runCommand(NAMESPACE_ID,"String_Node_Str" + queryTableName,true,Lists.newArrayList(new ColumnDesc("String_Node_Str","String_Node_Str",1,null)),Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList(5L))));
  datasetFramework.updateInstance(datasetInstanceId,props.setTableProperty("String_Node_Str",K_SCHEMA.toString()).build());
  runCommand(NAMESPACE_ID,"String_Node_Str" + queryTableName + "String_Node_Str",true,Lists.newArrayList(new ColumnDesc(hiveTableName + "String_Node_Str","String_Node_Str",1,null)),Lists.newArrayList(new QueryResult(Lists.<Object>newArrayList("String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str")),new QueryResult(Lists.<Object>newArrayList("String_Node_Str"))));
  datasetFramework.deleteInstance(datasetInstanceId);
  runCommand(NAMESPACE_ID,showTablesCommand,false,null,Collections.<QueryResult>emptyList());
  if (dbName != null) {
    runCommand(NAMESPACE_ID,"String_Node_Str" + dbName,false,null,null);
  }
}