nus-yam/ex-repair huggingface dataset:
Program: 96009
Project: 96009
Buggy source:
@Override public void run(){
  if (node.getSourceQueues().size() == 0) {
    try {
      executeAndBroadcast(Arrays.<ExecutionInfoToken>asList());
      broadcast(ExecutionInfoToken.successToken());
      return;
    }
 catch (    VerdictDBException e) {
      e.printStackTrace();
      broadcast(ExecutionInfoToken.failureToken(e));
    }
  }
  while (true) {
    List<ExecutionInfoToken> tokens=retrieve();
    if (tokens == null) {
      continue;
    }
    ExecutionInfoToken failureToken=getFailureTokenIfExists(tokens);
    if (failureToken != null) {
      broadcast(failureToken);
      break;
    }
    if (areAllSuccess(tokens)) {
      System.out.println(new ToStringBuilder(node,ToStringStyle.DEFAULT_STYLE) + "String_Node_Str" + successSourceCount);
      broadcast(ExecutionInfoToken.successToken());
      break;
    }
    try {
      executeAndBroadcast(tokens);
    }
 catch (    VerdictDBException e) {
      e.printStackTrace();
      broadcast(ExecutionInfoToken.failureToken(e));
      break;
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (node.getSourceQueues().size() == 0) {
    try {
      executeAndBroadcast(Arrays.<ExecutionInfoToken>asList());
      broadcast(ExecutionInfoToken.successToken());
      return;
    }
 catch (    VerdictDBException e) {
      e.printStackTrace();
      broadcast(ExecutionInfoToken.failureToken(e));
    }
  }
  while (true) {
    List<ExecutionInfoToken> tokens=retrieve();
    if (tokens == null) {
      continue;
    }
    System.out.println(new ToStringBuilder(node,ToStringStyle.DEFAULT_STYLE) + "String_Node_Str" + tokens);
    ExecutionInfoToken failureToken=getFailureTokenIfExists(tokens);
    if (failureToken != null) {
      broadcast(failureToken);
      break;
    }
    if (areAllSuccess(tokens)) {
      broadcast(ExecutionInfoToken.successToken());
      break;
    }
    try {
      executeAndBroadcast(tokens);
    }
 catch (    VerdictDBException e) {
      e.printStackTrace();
      broadcast(ExecutionInfoToken.failureToken(e));
      break;
    }
  }
}
Program: 96010
Project: 96010
Buggy source:
public static void runTillEnd(DbmsConnection conn,ExecutablePlan plan) throws VerdictDBException {
  ExecutionTokenReader reader=(new ExecutablePlanRunner(conn,plan)).getTokenReader();
  while (true) {
    ExecutionInfoToken token=reader.next();
    System.out.println("String_Node_Str" + token);
    if (token == null) {
      break;
    }
  }
}

Fixed version (ground truth):
public static void runTillEnd(DbmsConnection conn,ExecutablePlan plan) throws VerdictDBException {
  ExecutionTokenReader reader=(new ExecutablePlanRunner(conn,plan)).getTokenReader();
  while (true) {
    ExecutionInfoToken token=reader.next();
    if (token == null) {
      break;
    }
  }
}
Program: 96011
Project: 96011
Buggy source:
public ExecutionTokenReader getTokenReader(){
  ExecutionTokenReader reader;
  if (plan.getReportingNode() != null) {
    ExecutableNodeBase node=ExecutableNodeBase.create();
    node.subscribeTo((ExecutableNodeBase)plan.getReportingNode());
    reader=new ExecutionTokenReader(node.getSourceQueues().get(0));
  }
 else {
    reader=new ExecutionTokenReader();
  }
  ExecutorService executor=Executors.newCachedThreadPool();
  List<Integer> groupIds=plan.getNodeGroupIDs();
  List<List<ExecutableNode>> nodeGroups=new ArrayList<>();
  for (  int gid : groupIds) {
    List<ExecutableNode> nodes=plan.getNodesInGroup(gid);
    nodeGroups.add(nodes);
  }
  while (true) {
    boolean submittedAtLeastOne=false;
    for (int i=0; i < nodeGroups.size(); i++) {
      List<ExecutableNode> nodes=nodeGroups.get(i);
      if (!nodes.isEmpty()) {
        ExecutableNode node=nodes.remove(0);
        System.out.println("String_Node_Str" + node);
        executor.submit(new ExecutableNodeRunner(conn,node));
        submittedAtLeastOne=true;
      }
    }
    if (submittedAtLeastOne) {
      continue;
    }
 else {
      break;
    }
  }
  return reader;
}

Fixed version (ground truth):
public ExecutionTokenReader getTokenReader(){
  ExecutionTokenReader reader;
  if (plan.getReportingNode() != null) {
    ExecutableNodeBase node=ExecutableNodeBase.create();
    node.subscribeTo((ExecutableNodeBase)plan.getReportingNode());
    reader=new ExecutionTokenReader(node.getSourceQueues().get(0));
  }
 else {
    reader=new ExecutionTokenReader();
  }
  ExecutorService executor=Executors.newCachedThreadPool();
  List<Integer> groupIds=plan.getNodeGroupIDs();
  List<List<ExecutableNode>> nodeGroups=new ArrayList<>();
  for (  int gid : groupIds) {
    List<ExecutableNode> nodes=plan.getNodesInGroup(gid);
    nodeGroups.add(nodes);
  }
  while (true) {
    boolean submittedAtLeastOne=false;
    for (int i=0; i < nodeGroups.size(); i++) {
      List<ExecutableNode> nodes=nodeGroups.get(i);
      if (!nodes.isEmpty()) {
        ExecutableNode node=nodes.remove(0);
        executor.submit(new ExecutableNodeRunner(conn,node));
        submittedAtLeastOne=true;
      }
    }
    if (submittedAtLeastOne) {
      continue;
    }
 else {
      break;
    }
  }
  return reader;
}
Program: 96012
Project: 96012
Buggy source:
public List<ExecutableNodeBase> getSources(){
  List<ExecutableNodeBase> ss=new ArrayList<>();
  for (  Pair<ExecutableNodeBase,Integer> s : sources) {
    ss.add(s.getKey());
  }
  return ss;
}

Fixed version (ground truth):
public List<ExecutableNodeBase> getSources(){
  List<Pair<ExecutableNodeBase,Integer>> temp=getSourcesAndChannels();
  Collections.sort(temp,new Comparator<Pair<ExecutableNodeBase,Integer>>(){
    @Override public int compare(    Pair<ExecutableNodeBase,Integer> o1,    Pair<ExecutableNodeBase,Integer> o2){
      return o1.getRight() - o2.getRight();
    }
  }
);
  List<ExecutableNodeBase> ss=new ArrayList<>();
  for (  Pair<ExecutableNodeBase,Integer> s : temp) {
    ss.add(s.getKey());
  }
  return ss;
}
Program: 96013
Project: 96013
Buggy source:
@Override public void getNotified(ExecutableNode source,ExecutionInfoToken token){
  for (  Pair<ExecutableNodeBase,Integer> a : sources) {
    int channel=a.getRight();
    channels.get(channel).add(token);
  }
}

Fixed version (ground truth):
@Override public void getNotified(ExecutableNode source,ExecutionInfoToken token){
  for (  Pair<ExecutableNodeBase,Integer> a : sources) {
    if (source.equals(a.getLeft())) {
      int channel=a.getRight();
      channels.get(channel).add(token);
    }
  }
}
Program: 96014
Project: 96014
Buggy source:
protected void copyFields(ExecutableNodeBase from,ExecutableNodeBase to){
  to.subscribers=new ArrayList<>(from.subscribers);
  to.sources=new ArrayList<>(from.sources);
  to.channels=new TreeMap<>(from.channels);
}

Fixed version (ground truth):
protected void copyFields(ExecutableNodeBase from,ExecutableNodeBase to){
  to.subscribers=new ArrayList<>(from.subscribers);
  to.sources=new ArrayList<>(from.sources);
  to.channels=new TreeMap<>();
  for (  Entry<Integer,ExecutionTokenQueue> a : from.channels.entrySet()) {
    to.channels.put(a.getKey(),new ExecutionTokenQueue());
  }
}
Program: 96015
Project: 96015
Buggy source:
protected void copyFields(QueryNodeBase from,QueryNodeBase to){
  super.copyFields(from,to);
  to.selectQuery=from.selectQuery;
}

Fixed version (ground truth):
protected void copyFields(QueryNodeBase from,QueryNodeBase to){
  super.copyFields(from,to);
  to.selectQuery=from.selectQuery.deepcopy();
}
Program: 96016
Project: 96016
Buggy source:
/** 
 * Replicas of the group is made. The token queues among the group's nodes are replicated. The token queues outside the group's nodes are shared. This is for each replicated group to receive the same information from the downstream operations.
 * @param root
 * @return
 * @throws VerdictDBValueException 
 */
public AggExecutionNodeBlock deepcopyExcludingDependentAggregates() throws VerdictDBValueException {
  List<ExecutableNodeBase> newNodes=new ArrayList<>();
  for (  ExecutableNodeBase node : blockNodes) {
    ExecutableNodeBase copied=node.deepcopy();
    copied.clearSubscribers();
    newNodes.add(copied);
  }
  for (int i=0; i < newNodes.size(); i++) {
    ExecutableNodeBase newNode=newNodes.get(i);
    ExecutableNodeBase oldNode=blockNodes.get(i);
    for (int j=0; j < oldNode.getSources().size(); j++) {
      Pair<ExecutableNodeBase,Integer> source=oldNode.getSourcesAndChannels().get(j);
      int idx=blockNodes.indexOf(source.getLeft());
      if (idx >= 0) {
        newNode.subscribeTo(newNodes.get(idx),source.getRight());
      }
 else {
        newNode.subscribeTo(source.getLeft(),source.getRight());
      }
    }
  }
  int rootIdx=blockNodes.indexOf(blockRoot);
  return new AggExecutionNodeBlock(idCreator,newNodes.get(rootIdx));
}

Fixed version (ground truth):
/** 
 * Replicas of the group is made. The token queues among the group's nodes are replicated. The token queues outside the group's nodes are shared. This is for each replicated group to receive the same information from the downstream operations.
 * @param root
 * @return
 * @throws VerdictDBValueException 
 */
public AggExecutionNodeBlock deepcopyExcludingDependentAggregates() throws VerdictDBValueException {
  List<ExecutableNodeBase> newNodes=new ArrayList<>();
  for (  ExecutableNodeBase node : blockNodes) {
    ExecutableNodeBase copied=node.deepcopy();
    copied.clearSubscribers();
    newNodes.add(copied);
  }
  for (int i=0; i < newNodes.size(); i++) {
    ExecutableNodeBase newNode=newNodes.get(i);
    ExecutableNodeBase oldNode=blockNodes.get(i);
    for (int j=0; j < oldNode.getSources().size(); j++) {
      Pair<ExecutableNodeBase,Integer> source=oldNode.getSourcesAndChannels().get(j);
      int idx=blockNodes.indexOf(source.getLeft());
      newNode.cancelSubscriptionTo(source.getLeft());
      if (idx >= 0) {
        newNode.subscribeTo(newNodes.get(idx),source.getRight());
      }
 else {
        newNode.subscribeTo(source.getLeft(),source.getRight());
      }
    }
  }
  int rootIdx=blockNodes.indexOf(blockRoot);
  return new AggExecutionNodeBlock(idCreator,newNodes.get(rootIdx));
}
Program: 96017
Project: 96017
Buggy source:
@Override public ExecutionInfoToken executeNode(DbmsConnection conn,List<ExecutionInfoToken> downstreamResults) throws VerdictDBException {
  ExecutionInfoToken result=super.executeNode(conn,downstreamResults);
  if (parents.size() == 1 && (parents.get(0) instanceof AsyncAggExecutionNode || parents.get(0) instanceof AggCombinerExecutionNode)) {
    QueryExecutionNode asyncNode=parents.get(0);
    int index=0;
    while (!(asyncNode instanceof AsyncAggExecutionNode)) {
      asyncNode=asyncNode.parents.get(0);
      index++;
    }
    BaseTable scrambleTable=((AsyncAggExecutionNode)asyncNode).getScrambleTables().get(0);
    Dimension dimension=new Dimension(scrambleTable.getSchemaName(),scrambleTable.getTableName(),index,index);
    result.setKeyValue("String_Node_Str",Arrays.asList(new HyperTableCube(Arrays.asList(dimension))));
  }
  return result;
}

Fixed version (ground truth):
@Override public ExecutionInfoToken executeNode(DbmsConnection conn,List<ExecutionInfoToken> downstreamResults) throws VerdictDBException {
  ExecutionInfoToken result=super.executeNode(conn,downstreamResults);
  if (parents.get(0) instanceof AsyncAggScaleExecutionNode) {
    QueryExecutionNode asyncNode=parents.get(0);
    int index=-1;
    if (asyncNode.getParents().size() == 2) {
      index=0;
      asyncNode=asyncNode.getParents().get(1);
    }
 else {
      AsyncAggExecutionNode asyncRoot=asyncNode.getParents().get(0).getParents().size() == 2 ? (AsyncAggExecutionNode)asyncNode.getParents().get(0).getParents().get(1) : (AsyncAggExecutionNode)asyncNode.getParents().get(0).getParents().get(0);
      index=asyncRoot.getDependents().indexOf(asyncNode.getParents().get(0));
      asyncNode=asyncRoot;
    }
    BaseTable scrambleTable=((AsyncAggExecutionNode)asyncNode).getScrambleTables().get(0);
    Dimension dimension=new Dimension(scrambleTable.getSchemaName(),scrambleTable.getTableName(),index,index);
    result.setKeyValue("String_Node_Str",Arrays.asList(new HyperTableCube(Arrays.asList(dimension))));
  }
  return result;
}
Program: 96018
Project: 96018
Buggy source:
public double calculateScaleFactor(List<HyperTableCube> cubes){
  double executedRatio=0;
  ScrambleMeta scrambleMeta=((AsyncAggExecutionNode)(this.dependents.get(0))).getScrambleMeta();
  int totalSize=1;
  for (  Dimension d : cubes.get(0).getDimensions()) {
    int blockCount=scrambleMeta.getAggregationBlockCount(d.getSchemaName(),d.getTableName());
    totalSize=totalSize * blockCount;
  }
  int count=0;
  for (  HyperTableCube cube : cubes) {
    int volume=1;
    for (    Dimension d : cube.getDimensions()) {
      volume=volume * d.length();
    }
    count+=volume;
  }
  return totalSize / count;
}

Fixed version (ground truth):
public double calculateScaleFactor(List<HyperTableCube> cubes){
  AsyncAggExecutionNode asyncNode;
  if (this.getParents().size() == 2) {
    asyncNode=(AsyncAggExecutionNode)this.getParents().get(1);
  }
 else {
    asyncNode=this.getParents().get(0).getParents().size() == 2 ? (AsyncAggExecutionNode)this.getParents().get(0).getParents().get(1) : (AsyncAggExecutionNode)this.getParents().get(0).getParents().get(0);
  }
  ScrambleMeta scrambleMeta=asyncNode.getScrambleMeta();
  int totalSize=1;
  for (  Dimension d : cubes.get(0).getDimensions()) {
    int blockCount=scrambleMeta.getAggregationBlockCount(d.getSchemaName(),d.getTableName());
    totalSize=totalSize * blockCount;
  }
  int count=0;
  for (  HyperTableCube cube : cubes) {
    int volume=1;
    for (    Dimension d : cube.getDimensions()) {
      volume=volume * d.length();
    }
    count+=volume;
  }
  return totalSize / count;
}
Program: 96020
Project: 96020
Buggy source:
void compressTwoNode(QueryExecutionNode node,QueryExecutionNode parent){
  BaseTable placeholderTableinParent=((QueryExecutionNodeWithPlaceHolders)parent).getPlaceholderTables().get(parent.dependents.indexOf(node));
  if (parent.selectQuery.getFromList().contains(placeholderTableinParent)) {
    int index=parent.selectQuery.getFromList().indexOf(placeholderTableinParent);
    node.selectQuery.setAliasName(parent.selectQuery.getFromList().get(index).getAliasName().get());
    parent.selectQuery.getFromList().set(index,node.selectQuery);
  }
 else {
    List<SubqueryColumn> placeholderTablesinFilter=((QueryExecutionNodeWithPlaceHolders)parent).getPlaceholderTablesinFilter();
    for (    SubqueryColumn filter : placeholderTablesinFilter) {
      if (filter.getSubquery().getFromList().size() == 1 && filter.getSubquery().getFromList().get(0).equals(placeholderTableinParent)) {
        filter.setSubquery(node.selectQuery);
      }
    }
  }
  parent.getListeningQueues().removeAll(node.broadcastingQueues);
  parent.getListeningQueues().addAll(node.getListeningQueues());
  parent.dependents.remove(node);
  parent.dependents.addAll(node.dependents);
  for (  QueryExecutionNode dependent : node.dependents) {
    dependent.parents.remove(node);
    dependent.parents.add(parent);
  }
}

Fixed version (ground truth):
void compressTwoNode(QueryExecutionNode node,QueryExecutionNode parent){
  BaseTable placeholderTableinParent=((QueryExecutionNodeWithPlaceHolders)parent).getPlaceholderTables().get(parent.dependents.indexOf(node));
  ((QueryExecutionNodeWithPlaceHolders)parent).getPlaceholderTables().remove(placeholderTableinParent);
  if (parent.selectQuery.getFromList().contains(placeholderTableinParent)) {
    int index=parent.selectQuery.getFromList().indexOf(placeholderTableinParent);
    node.selectQuery.setAliasName(parent.selectQuery.getFromList().get(index).getAliasName().get());
    parent.selectQuery.getFromList().set(index,node.selectQuery);
  }
 else {
    List<SubqueryColumn> placeholderTablesinFilter=((QueryExecutionNodeWithPlaceHolders)parent).getPlaceholderTablesinFilter();
    for (    SubqueryColumn filter : placeholderTablesinFilter) {
      if (filter.getSubquery().getFromList().size() == 1 && filter.getSubquery().getFromList().get(0).equals(placeholderTableinParent)) {
        filter.setSubquery(node.selectQuery);
      }
    }
  }
  parent.getListeningQueues().removeAll(node.broadcastingQueues);
  parent.getListeningQueues().addAll(node.getListeningQueues());
  parent.getLatestResults().clear();
  for (int i=0; i < parent.getLatestResults().size(); i++) {
    parent.getLatestResults().add(Optional.<ExecutionInfoToken>absent());
  }
  parent.dependents.remove(node);
  parent.dependents.addAll(node.dependents);
  for (  QueryExecutionNode dependent : node.dependents) {
    dependent.parents.remove(node);
    dependent.parents.add(parent);
  }
}
Program: 96023
Project: 96023
Buggy source:
@Test public void ScrambleTableTest() throws VerdictDBException {
  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();
  queryExecutionPlan=AsyncQueryExecutionPlan.create(queryExecutionPlan);
  assertEquals(2,queryExecutionPlan.getRootNode().dependents.get(0).dependents.get(0).getParents().size());
}

Fixed version (ground truth):
@Test public void ScrambleTableTest() 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();
  queryExecutionPlan=AsyncQueryExecutionPlan.create(queryExecutionPlan);
  ((AsyncAggExecutionNode)queryExecutionPlan.getRoot().dependents.get(0)).addScrambleTable(new BaseTable(originalSchema,"String_Node_Str"));
  ((AsyncAggExecutionNode)queryExecutionPlan.getRoot().dependents.get(0)).setScrambleMeta(meta);
  queryExecutionPlan.setScalingNode();
  stmt.execute("String_Node_Str");
  queryExecutionPlan.root.executeAndWaitForTermination(new JdbcConnection(conn,new H2Syntax()));
  stmt.execute("String_Node_Str");
}
Program: 96027
Project: 96027
Buggy source:
public boolean execute(String query) throws VerdictDBDbmsException ;

Fixed version (ground truth):
public DbmsQueryResult execute(String query) throws VerdictDBDbmsException ;
Program: 96028
Project: 96028
Buggy source:
@Override public boolean execute(String sql) throws VerdictDBDbmsException {
  System.out.println("String_Node_Str" + sql);
  try {
    Statement stmt=conn.createStatement();
    boolean doesResultExist=stmt.execute(sql);
    if (doesResultExist) {
      ResultSet rs=stmt.getResultSet();
      jrs=new JdbcQueryResult(rs);
      rs.close();
    }
 else {
      jrs=null;
    }
    stmt.close();
    return doesResultExist;
  }
 catch (  SQLException e) {
    throw new VerdictDBDbmsException(e.getMessage());
  }
}

Fixed version (ground truth):
@Override public DbmsQueryResult execute(String sql) throws VerdictDBDbmsException {
  try {
    Statement stmt=conn.createStatement();
    JdbcQueryResult jrs=null;
    boolean doesResultExist=stmt.execute(sql);
    if (doesResultExist) {
      ResultSet rs=stmt.getResultSet();
      jrs=new JdbcQueryResult(rs);
      rs.close();
    }
 else {
      jrs=null;
    }
    stmt.close();
    return jrs;
  }
 catch (  SQLException e) {
    throw new VerdictDBDbmsException(e.getMessage());
  }
}
Program: 96029
Project: 96029
Buggy source:
public DbmsQueryResult executeQuery(String sql) throws VerdictDBDbmsException {
  execute(sql);
  return getResult();
}

Fixed version (ground truth):
public DbmsQueryResult executeQuery(String sql) throws VerdictDBDbmsException {
  return execute(sql);
}
Program: 96030
Project: 96030
Buggy source:
@Override public boolean execute(String query) throws VerdictDBDbmsException {
  return false;
}

Fixed version (ground truth):
@Override public DbmsQueryResult execute(String query) throws VerdictDBDbmsException {
  return null;
}
Program: 96031
Project: 96031
Buggy source:
public ExecutableNodeRunner(DbmsConnection conn,ExecutableNode node){
  this.conn=conn;
  this.node=node;
}

Fixed version (ground truth):
public ExecutableNodeRunner(DbmsConnection conn,ExecutableNode node){
  this.conn=conn;
  this.node=node;
  this.dependentCount=node.getDependentNodeCount();
}
Program: 96032
Project: 96032
Buggy source:
@Override public void run(){
  if (node.getSourceQueues().size() == 0) {
    try {
      executeAndBroadcast(Arrays.<ExecutionInfoToken>asList());
      broadcast(ExecutionInfoToken.successToken());
      return;
    }
 catch (    VerdictDBException e) {
      e.printStackTrace();
      broadcast(ExecutionInfoToken.failureToken());
    }
  }
  while (true) {
    List<ExecutionInfoToken> tokens=retrieve();
    if (tokens == null) {
      continue;
    }
    if (doesIncludeFailure(tokens)) {
      broadcast(ExecutionInfoToken.failureToken());
      break;
    }
    if (areAllSuccess(tokens)) {
      broadcast(ExecutionInfoToken.successToken());
      break;
    }
    try {
      executeAndBroadcast(tokens);
    }
 catch (    VerdictDBException e) {
      e.printStackTrace();
      broadcast(ExecutionInfoToken.failureToken());
      break;
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (node.getSourceQueues().size() == 0) {
    try {
      executeAndBroadcast(Arrays.<ExecutionInfoToken>asList());
      broadcast(ExecutionInfoToken.successToken());
      return;
    }
 catch (    VerdictDBException e) {
      e.printStackTrace();
      broadcast(ExecutionInfoToken.failureToken(e));
    }
  }
  while (true) {
    List<ExecutionInfoToken> tokens=retrieve();
    if (tokens == null) {
      continue;
    }
    if (doesIncludeFailure(tokens)) {
      broadcast(ExecutionInfoToken.failureToken());
      break;
    }
    if (areAllSuccess(tokens)) {
      broadcast(ExecutionInfoToken.successToken());
      break;
    }
    try {
      executeAndBroadcast(tokens);
    }
 catch (    VerdictDBException e) {
      e.printStackTrace();
      broadcast(ExecutionInfoToken.failureToken(e));
      break;
    }
  }
}
Program: 96033
Project: 96033
Buggy source:
boolean areAllSuccess(List<ExecutionInfoToken> latestResults){
  for (  ExecutionInfoToken t : latestResults) {
    if (t.isStatusToken()) {
    }
 else {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
boolean areAllSuccess(List<ExecutionInfoToken> latestResults){
  for (  ExecutionInfoToken t : latestResults) {
    if (t.isSuccessToken()) {
      successSourceCount++;
    }
 else {
      return false;
    }
  }
  if (successSourceCount == dependentCount) {
    return true;
  }
 else {
    return false;
  }
}
Program: 96034
Project: 96034
Buggy source:
void executeAndBroadcast(List<ExecutionInfoToken> tokens) throws VerdictDBException {
  ExecutionInfoToken resultToken=execute(tokens);
  broadcast(resultToken);
}

Fixed version (ground truth):
void executeAndBroadcast(List<ExecutionInfoToken> tokens) throws VerdictDBException {
  ExecutionInfoToken resultToken=execute(tokens);
  if (resultToken != null) {
    broadcast(resultToken);
  }
}
Program: 96035
Project: 96035
Buggy source:
public ExecutionInfoToken execute(List<ExecutionInfoToken> tokens) throws VerdictDBException {
  SqlConvertable sqlObj=node.createQuery(tokens);
  boolean doesResultExist=false;
  if (sqlObj != null) {
    String sql=QueryToSql.convert(conn.getSyntax(),sqlObj);
    doesResultExist=conn.execute(sql);
  }
  DbmsQueryResult intermediate=null;
  if (doesResultExist) {
    intermediate=conn.getResult();
  }
  return node.createToken(intermediate);
}

Fixed version (ground truth):
public ExecutionInfoToken execute(List<ExecutionInfoToken> tokens) throws VerdictDBException {
  if (tokens.size() > 0 && tokens.get(0).isStatusToken()) {
    return null;
  }
  SqlConvertable sqlObj=node.createQuery(tokens);
  DbmsQueryResult intermediate=null;
  if (sqlObj != null) {
    String sql=QueryToSql.convert(conn.getSyntax(),sqlObj);
    intermediate=conn.execute(sql);
  }
  return node.createToken(intermediate);
}
Program: 96036
Project: 96036
Buggy source:
public static void runTillEnd(DbmsConnection conn,ExecutablePlan plan){
  ExecutionTokenReader reader=(new ExecutablePlanRunner(conn,plan)).getTokenReader();
  while (reader.next() != null) {
  }
}

Fixed version (ground truth):
public static void runTillEnd(DbmsConnection conn,ExecutablePlan plan){
  ExecutionTokenReader reader=(new ExecutablePlanRunner(conn,plan)).getTokenReader();
  while (true) {
    ExecutionInfoToken token=reader.next();
    if (token == null) {
      break;
    }
 else {
    }
  }
}
Program: 96037
Project: 96037
Buggy source:
public static ExecutionInfoToken failureToken(){
  ExecutionInfoToken token=new ExecutionInfoToken();
  token.setKeyValue("String_Node_Str","String_Node_Str");
  return token;
}

Fixed version (ground truth):
public static ExecutionInfoToken failureToken(Exception e){
  ExecutionInfoToken token=new ExecutionInfoToken();
  token.setKeyValue("String_Node_Str","String_Node_Str");
  token.setKeyValue("String_Node_Str",e);
  return token;
}
Program: 96038
Project: 96038
Buggy source:
@Test public void nestedAggregateFromTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  StandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}

Fixed version (ground truth):
@Test public void nestedAggregateFromTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  ResultStandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}
Program: 96039
Project: 96039
Buggy source:
@Test public void simpleAggregateTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  StandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}

Fixed version (ground truth):
@Test public void simpleAggregateTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  ResultStandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}
Program: 96040
Project: 96040
Buggy source:
@Test public void nestedAggregateWithGroupbyTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  StandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}

Fixed version (ground truth):
@Test public void nestedAggregateWithGroupbyTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  ResultStandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}
Program: 96041
Project: 96041
Buggy source:
@Test public void aggregateWithGroupbyTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  StandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}

Fixed version (ground truth):
@Test public void aggregateWithGroupbyTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  ResultStandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}
Program: 96042
Project: 96042
Buggy source:
@Test public void nestedAggregateFilterTest() throws VerdictDBException {
  String sql="String_Node_Str" + "String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  StandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}

Fixed version (ground truth):
@Test public void nestedAggregateFilterTest() throws VerdictDBException {
  String sql="String_Node_Str" + "String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  queryExecutionPlan.getRoot().print();
  ResultStandardOutputPrinter.run(ExecutablePlanRunner.getResultReader(conn,queryExecutionPlan));
}
Program: 96043
Project: 96043
Buggy source:
@Override public ExecutionInfoToken executeNode(DbmsConnection conn,List<ExecutionInfoToken> downstreamResults) throws VerdictDBException {
  ExecutionInfoToken result=super.executeNode(conn,downstreamResults);
  if (parents.size() == 1 && (parents.get(0) instanceof AsyncAggExecutionNode || parents.get(0) instanceof AggCombinerExecutionNode)) {
    QueryExecutionNode asyncNode=parents.get(0);
    int index=0;
    while (!(asyncNode instanceof AsyncAggExecutionNode)) {
      asyncNode=asyncNode.parents.get(0);
      index++;
    }
    BaseTable scrambleTable=((AsyncAggExecutionNode)asyncNode).getScrambleTables().get(0);
    Dimension dimension=new Dimension(scrambleTable.getSchemaName(),scrambleTable.getTableName(),index,index);
    result.setKeyValue("String_Node_Str",Arrays.asList(new HyperTableCube(Arrays.asList(dimension))));
  }
  return result;
}

Fixed version (ground truth):
@Override public ExecutionInfoToken executeNode(DbmsConnection conn,List<ExecutionInfoToken> downstreamResults) throws VerdictDBException {
  ExecutionInfoToken result=super.executeNode(conn,downstreamResults);
  return result;
}
Program: 96044
Project: 96044
Buggy source:
public ExecutionInfoToken take(){
  try {
    return internalQueue.take();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public ExecutionInfoToken take(){
  try {
    return internalQueue.takeFirst();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return null;
}
Program: 96045
Project: 96045
Buggy source:
@Override public void run(){
  while (true) {
    if (listeningQueues.size() == 0) {
      int ret=process(conn,Arrays.<ExecutionInfoToken>asList());
      if (ret == 0) {
        broadcast(ExecutionInfoToken.successToken());
        setSuccess();
      }
 else {
        broadcast(ExecutionInfoToken.failureToken());
        setFailure();
      }
      break;
    }
    readLatestResultsFromDependents();
    if (doesFailedDependentExist()) {
      broadcast(ExecutionInfoToken.failureToken());
      setFailure();
      break;
    }
    if (areDependentsAllSuccess()) {
      broadcast(ExecutionInfoToken.successToken());
      setSuccess();
      break;
    }
    List<ExecutionInfoToken> latestResults=getLatestResultsIfAvailable();
    if (latestResults == null) {
      continue;
    }
    int ret=process(conn,latestResults);
    if (ret != 0) {
      broadcast(ExecutionInfoToken.failureToken());
      setFailure();
      break;
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    if (listeningQueues.size() == 0) {
      int ret=process(conn,Arrays.<ExecutionInfoToken>asList());
      if (ret == 0) {
        setSuccess();
        broadcast(ExecutionInfoToken.successToken());
      }
 else {
        setFailure();
        broadcast(ExecutionInfoToken.failureToken());
      }
      break;
    }
    List<ExecutionInfoToken> latestResults=getResultsFromQueues();
    if (latestResults == null) {
      continue;
    }
    if (doesIncludeFailure(latestResults)) {
      setFailure();
      broadcast(ExecutionInfoToken.failureToken());
      break;
    }
    if (areAllSuccess(latestResults)) {
      setSuccess();
      broadcast(ExecutionInfoToken.successToken());
      break;
    }
    int ret=process(conn,latestResults);
    if (ret != 0) {
      setFailure();
      broadcast(ExecutionInfoToken.failureToken());
      break;
    }
  }
}
Program: 96046
Project: 96046
Buggy source:
void copyFields(QueryExecutionNode from,QueryExecutionNode to){
  to.selectQuery=from.selectQuery.deepcopy();
  to.status=from.status;
  to.parents.addAll(from.parents);
  to.dependents.addAll(from.dependents);
  to.broadcastingQueues.addAll(from.broadcastingQueues);
  to.listeningQueues.addAll(from.listeningQueues);
  to.latestResults.addAll(from.latestResults);
}

Fixed version (ground truth):
void copyFields(QueryExecutionNode from,QueryExecutionNode to){
  to.selectQuery=from.selectQuery.deepcopy();
  to.status=from.status;
  to.parents.addAll(from.parents);
  to.dependents.addAll(from.dependents);
  to.broadcastingQueues.addAll(from.broadcastingQueues);
  to.listeningQueues.addAll(from.listeningQueues);
}
Program: 96047
Project: 96047
Buggy source:
public ExecutionTokenQueue generateReplacementListeningQueue(int index) throws VerdictDBValueException {
  ExecutionTokenQueue queue=new ExecutionTokenQueue();
  listeningQueues.set(index,queue);
  if (listeningQueues.size() != latestResults.size()) {
    throw new VerdictDBValueException("String_Node_Str");
  }
  return queue;
}

Fixed version (ground truth):
public ExecutionTokenQueue generateReplacementListeningQueue(int index) throws VerdictDBValueException {
  ExecutionTokenQueue queue=new ExecutionTokenQueue();
  listeningQueues.set(index,queue);
  return queue;
}
Program: 96049
Project: 96049
Buggy source:
public ExecutionTokenQueue generateListeningQueue() throws VerdictDBValueException {
  ExecutionTokenQueue queue=new ExecutionTokenQueue();
  listeningQueues.add(queue);
  latestResults.add(Optional.<ExecutionInfoToken>absent());
  if (listeningQueues.size() != latestResults.size()) {
    throw new VerdictDBValueException("String_Node_Str");
  }
  return queue;
}

Fixed version (ground truth):
public ExecutionTokenQueue generateListeningQueue() throws VerdictDBValueException {
  ExecutionTokenQueue queue=new ExecutionTokenQueue();
  listeningQueues.add(queue);
  return queue;
}
Program: 96050
Project: 96050
Buggy source:
@Override public String toString(){
  return new ToStringBuilder(this,ToStringStyle.DEFAULT_STYLE).append("String_Node_Str",status).append("String_Node_Str",listeningQueues).append("String_Node_Str",broadcastingQueues).append("String_Node_Str",latestResults).append("String_Node_Str",selectQuery).toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return new ToStringBuilder(this,ToStringStyle.DEFAULT_STYLE).append("String_Node_Str",status).append("String_Node_Str",listeningQueues).append("String_Node_Str",broadcastingQueues).append("String_Node_Str",selectQuery).toString();
}
Program: 96053
Project: 96053
Buggy source:
private SelectAllExecutionNode(){
  super(null);
}

Fixed version (ground truth):
private SelectAllExecutionNode(QueryExecutionPlan plan){
  super(plan);
}
Program: 96054
Project: 96054
Buggy source:
public static SelectAllExecutionNode create(QueryExecutionPlan plan,SelectQuery query){
  SelectAllExecutionNode selectAll=new SelectAllExecutionNode();
  Pair<BaseTable,ExecutionTokenQueue> baseAndQueue=selectAll.createPlaceHolderTable("String_Node_Str");
  SelectQuery selectQuery=SelectQuery.create(new AsteriskColumn(),baseAndQueue.getLeft());
  selectAll.setSelectQuery(selectQuery);
  if (query.isAggregateQuery()) {
    AggExecutionNode dependent=AggExecutionNode.create(plan,query);
    dependent.addBroadcastingQueue(baseAndQueue.getRight());
    selectAll.addDependency(dependent);
  }
 else {
    ProjectionExecutionNode dependent=ProjectionExecutionNode.create(plan,query);
    dependent.addBroadcastingQueue(baseAndQueue.getRight());
    selectAll.addDependency(dependent);
  }
  return selectAll;
}

Fixed version (ground truth):
public static SelectAllExecutionNode create(QueryExecutionPlan plan,SelectQuery query){
  SelectAllExecutionNode selectAll=new SelectAllExecutionNode(plan);
  Pair<BaseTable,ExecutionTokenQueue> baseAndQueue=selectAll.createPlaceHolderTable("String_Node_Str");
  SelectQuery selectQuery=SelectQuery.create(new AsteriskColumn(),baseAndQueue.getLeft());
  selectAll.setSelectQuery(selectQuery);
  if (query.isAggregateQuery()) {
    AggExecutionNode dependent=AggExecutionNode.create(plan,query);
    dependent.addBroadcastingQueue(baseAndQueue.getRight());
    selectAll.addDependency(dependent);
  }
 else {
    ProjectionExecutionNode dependent=ProjectionExecutionNode.create(plan,query);
    dependent.addBroadcastingQueue(baseAndQueue.getRight());
    selectAll.addDependency(dependent);
  }
  return selectAll;
}
Program: 96055
Project: 96055
Buggy source:
@Override public QueryExecutionNode deepcopy(){
  SelectAllExecutionNode node=new SelectAllExecutionNode();
  copyFields(this,node);
  return node;
}

Fixed version (ground truth):
@Override public QueryExecutionNode deepcopy(){
  SelectAllExecutionNode node=new SelectAllExecutionNode(plan);
  copyFields(this,node);
  return node;
}
Program: 96057
Project: 96057
Buggy source:
@Override public Object getValue(int index){
  index=aggregateFrame.getOrderedColumnIndex().get(index);
  if (index < ((AggregateGroup)currentEntry.getKey()).attributeValues.size()) {
    return ((AggregateGroup)currentEntry.getKey()).attributeValues.get(index);
  }
 else {
    return ((AggregateMeasures)currentEntry.getValue()).attributeValues.get(index - ((AggregateGroup)currentEntry.getKey()).attributeValues.size());
  }
}

Fixed version (ground truth):
@Override public Object getValue(int index){
  index=orderedColumnIndex.get(index);
  if (index < ((AggregateGroup)currentEntry.getKey()).attributeValues.size()) {
    return ((AggregateGroup)currentEntry.getKey()).attributeValues.get(index);
  }
 else {
    return ((AggregateMeasures)currentEntry.getValue()).attributeValues.get(index - ((AggregateGroup)currentEntry.getKey()).attributeValues.size());
  }
}
Program: 96058
Project: 96058
Buggy source:
public AggregateFrameQueryResult(AggregateFrame aggregateFrame){
  this.aggregateFrame=aggregateFrame;
  it=aggregateFrame.data.entrySet().iterator();
}

Fixed version (ground truth):
public AggregateFrameQueryResult(AggregateFrame aggregateFrame){
  this.aggregateFrame=aggregateFrame;
  it=aggregateFrame.data.entrySet().iterator();
  List<String> orderedColumnName=aggregateFrame.getColumnNames();
  if (!aggregateFrame.data.entrySet().isEmpty()) {
    AggregateGroup group=((AggregateGroup)(aggregateFrame.data.keySet().toArray()[0]));
    AggregateMeasures measures=(AggregateMeasures)(aggregateFrame.data.values().toArray()[0]);
    for (int i=0; i < group.attributeNames.size(); i++) {
      orderedColumnIndex.add(orderedColumnName.indexOf(group.attributeNames.get(i)));
    }
    for (int i=0; i < measures.attributeNames.size(); i++) {
      orderedColumnIndex.add(orderedColumnName.indexOf(measures.attributeNames.get(i)));
    }
  }
}
Program: 96059
Project: 96059
Buggy source:
protected void createStratifiedSample(SampleParam param) throws VerdictException {
  VerdictLogger.info(this,String.format("String_Node_Str",param.getSamplingRatio() * 100,param.getOriginalTable(),param.colNamesInString()));
  Pair<Long,Long> sampleAndOriginalSizes=vc.getDbms().createStratifiedSampleTableOf(param);
  if (sampleAndOriginalSizes == null) {
    double heuristicRatio=this.heuristicSampleSizeSuggestion(param);
    SampleParam uniformSample=new SampleParam(param);
    uniformSample.setSamplingRatio(heuristicRatio);
    uniformSample.setSampleType("String_Node_Str");
    uniformSample.setColumnNames(new ArrayList<String>());
    VerdictLogger.info(this,String.format("String_Node_Str"));
    createUniformRandomSample(uniformSample);
    sampleAndOriginalSizes=vc.getDbms().createUniformRandomSampleTableOf(uniformSample);
    vc.getMeta().insertSampleInfo(param,sampleAndOriginalSizes.getLeft(),sampleAndOriginalSizes.getRight());
    vc.getMeta().refreshDatabases();
    vc.getMeta().refreshTables(uniformSample.getOriginalTable().getSchemaName());
    vc.getMeta().refreshSampleInfo(uniformSample.getOriginalTable().getSchemaName(),true);
    sampleAndOriginalSizes=vc.getDbms().createStratifiedSampleTableOf(param);
  }
  vc.getMeta().insertSampleInfo(param,sampleAndOriginalSizes.getLeft(),sampleAndOriginalSizes.getRight());
}

Fixed version (ground truth):
protected void createStratifiedSample(SampleParam param) throws VerdictException {
  VerdictLogger.info(this,String.format("String_Node_Str",param.getSamplingRatio() * 100,param.getOriginalTable(),param.colNamesInString()));
  Pair<Long,Long> sampleAndOriginalSizes=vc.getDbms().createStratifiedSampleTableOf(param);
  if (sampleAndOriginalSizes == null) {
    double heuristicRatio=this.heuristicSampleSizeSuggestion(param);
    SampleParam uniformSample=new SampleParam(param);
    uniformSample.setSamplingRatio(heuristicRatio);
    uniformSample.setSampleType("String_Node_Str");
    uniformSample.setColumnNames(new ArrayList<String>());
    VerdictLogger.info(this,String.format("String_Node_Str"));
    createUniformRandomSample(uniformSample);
    sampleAndOriginalSizes=vc.getDbms().createUniformRandomSampleTableOf(uniformSample);
    vc.getMeta().insertSampleInfo(uniformSample,sampleAndOriginalSizes.getLeft(),sampleAndOriginalSizes.getRight());
    vc.getMeta().refreshDatabases();
    vc.getMeta().refreshTables(uniformSample.getOriginalTable().getSchemaName());
    vc.getMeta().refreshSampleInfo(uniformSample.getOriginalTable().getSchemaName(),true);
    sampleAndOriginalSizes=vc.getDbms().createStratifiedSampleTableOf(param);
  }
  vc.getMeta().insertSampleInfo(param,sampleAndOriginalSizes.getLeft(),sampleAndOriginalSizes.getRight());
}
Program: 96060
Project: 96060
Buggy source:
protected void createStratifiedSample(SampleParam param) throws VerdictException {
  VerdictLogger.info(this,String.format("String_Node_Str",param.getSamplingRatio() * 100,param.getOriginalTable(),param.colNamesInString()));
  Pair<Long,Long> sampleAndOriginalSizes=vc.getDbms().createStratifiedSampleTableOf(param);
  if (sampleAndOriginalSizes == null) {
    double heuristicRatio=this.heuristicSampleSizeSuggestion(param);
    SampleParam uniformSample=new SampleParam(param);
    uniformSample.setSamplingRatio(heuristicRatio);
    uniformSample.setSampleType("String_Node_Str");
    uniformSample.setColumnNames(new ArrayList<String>());
    VerdictLogger.info(this,String.format("String_Node_Str"));
    createUniformRandomSample(uniformSample);
    sampleAndOriginalSizes=vc.getDbms().createUniformRandomSampleTableOf(uniformSample);
    vc.getMeta().insertSampleInfo(param,sampleAndOriginalSizes.getLeft(),sampleAndOriginalSizes.getRight());
    vc.getMeta().refreshDatabases();
    vc.getMeta().refreshTables(uniformSample.getOriginalTable().getSchemaName());
    vc.getMeta().refreshSampleInfo(uniformSample.getOriginalTable().getSchemaName(),true);
    sampleAndOriginalSizes=vc.getDbms().createStratifiedSampleTableOf(param);
  }
  vc.getMeta().insertSampleInfo(param,sampleAndOriginalSizes.getLeft(),sampleAndOriginalSizes.getRight());
}

Fixed version (ground truth):
protected void createStratifiedSample(SampleParam param) throws VerdictException {
  VerdictLogger.info(this,String.format("String_Node_Str",param.getSamplingRatio() * 100,param.getOriginalTable(),param.colNamesInString()));
  Pair<Long,Long> sampleAndOriginalSizes=vc.getDbms().createStratifiedSampleTableOf(param);
  if (sampleAndOriginalSizes == null) {
    double heuristicRatio=this.heuristicSampleSizeSuggestion(param);
    SampleParam uniformSample=new SampleParam(param);
    uniformSample.setSamplingRatio(heuristicRatio);
    uniformSample.setSampleType("String_Node_Str");
    uniformSample.setColumnNames(new ArrayList<String>());
    VerdictLogger.info(this,String.format("String_Node_Str"));
    createUniformRandomSample(uniformSample);
    sampleAndOriginalSizes=vc.getDbms().createUniformRandomSampleTableOf(uniformSample);
    vc.getMeta().insertSampleInfo(uniformSample,sampleAndOriginalSizes.getLeft(),sampleAndOriginalSizes.getRight());
    vc.getMeta().refreshDatabases();
    vc.getMeta().refreshTables(uniformSample.getOriginalTable().getSchemaName());
    vc.getMeta().refreshSampleInfo(uniformSample.getOriginalTable().getSchemaName(),true);
    sampleAndOriginalSizes=vc.getDbms().createStratifiedSampleTableOf(param);
  }
  vc.getMeta().insertSampleInfo(param,sampleAndOriginalSizes.getLeft(),sampleAndOriginalSizes.getRight());
}
Program: 96061
Project: 96061
Buggy source:
public static Relation queryToRelation(VerdictContext vc,String sql) throws VerdictException {
  ExactRelation r=ExactRelation.from(vc,sql);
  VerdictSQLParser p=StringManipulations.parserOf(sql);
  VerdictSQLBaseVisitor<Boolean> visitor=new VerdictSQLBaseVisitor<Boolean>(){
    @Override public Boolean visitSelect_statement(    VerdictSQLParser.Select_statementContext ctx){
      return (ctx.EXACT() != null) ? true : false;
    }
  }
;
  Boolean exact=visitor.visit(p.select_statement());
  if (exact) {
    return r;
  }
 else {
    Map<TableUniqueName,SampleParam> forcedSamples=VerdictConf.getForcedSamples();
    ApproxRelation a=(forcedSamples == null) ? r.approx() : r.approxWith(forcedSamples);
    return a;
  }
}

Fixed version (ground truth):
public static Relation queryToRelation(VerdictContext vc,String sql) throws VerdictException {
  ExactRelation r=ExactRelation.from(vc,sql);
  VerdictSQLParser p=StringManipulations.parserOf(sql);
  VerdictSQLBaseVisitor<Boolean> visitor=new VerdictSQLBaseVisitor<Boolean>(){
    @Override public Boolean visitSelect_statement(    VerdictSQLParser.Select_statementContext ctx){
      return (ctx.EXACT() != null) ? true : false;
    }
  }
;
  Boolean exact=visitor.visit(p.select_statement());
  if (exact) {
    return r;
  }
 else {
    Map<TableUniqueName,SampleParam> forcedSamples=VerdictConf.getSamplesToUse();
    ApproxRelation a=(forcedSamples == null) ? r.approx() : r.approxWith(forcedSamples);
    return a;
  }
}