Program: 96024
Project: 96024
Buggy source:
@Test public void NestedAggregateWithScrambleTableHavingCommonChildrenTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  BaseTable base=new BaseTable(originalSchema,originalTable,"String_Node_Str");
  SelectQuery leftQuery=SelectQuery.create(new AliasedColumn(ColumnOp.count(),"String_Node_Str"),base);
  leftQuery.addFilterByAnd(ColumnOp.lessequal(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf(5.0)));
  SelectQuery rightQuery=SelectQuery.create(new AliasedColumn(ColumnOp.count(),"String_Node_Str"),base);
  rightQuery.addFilterByAnd(ColumnOp.greater(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf(5.0)));
  AggExecutionNode leftNode=AggExecutionNode.create(null,leftQuery);
  AggExecutionNode rightNode=AggExecutionNode.create(null,rightQuery);
  ExecutionTokenQueue queue=new ExecutionTokenQueue();
  AggCombinerExecutionNode combiner=AggCombinerExecutionNode.create(queryExecutionPlan,leftNode,rightNode);
  combiner.addBroadcastingQueue(queue);
  AsyncAggExecutionNode asyncAggExecutionNode=AsyncAggExecutionNode.create(null,Arrays.<QueryExecutionNode>asList(leftNode,rightNode),Arrays.<QueryExecutionNode>asList(combiner));
  queryExecutionPlan.root.dependents.get(0).getDependents().remove(0);
  queryExecutionPlan.root.dependents.get(0).getListeningQueues().remove(0);
  asyncAggExecutionNode.addBroadcastingQueue(queryExecutionPlan.root.dependents.get(0).generateListeningQueue());
  queryExecutionPlan.root.dependents.get(0).addDependency(asyncAggExecutionNode);
  SelectQuery commonQuery=SelectQuery.create(new AliasedColumn(ColumnOp.count(),"String_Node_Str"),base);
  rightQuery.addFilterByAnd(ColumnOp.greater(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf(5.0)));
  AggExecutionNode common=AggExecutionNode.create(null,commonQuery);
  leftQuery.addFilterByAnd(ColumnOp.lessequal(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf(5.0)));
  leftNode.addDependency(common);
  common.addBroadcastingQueue(leftNode.generateListeningQueue());
  rightNode.addDependency(common);
  common.addBroadcastingQueue(rightNode.generateListeningQueue());
  QueryExecutionNode copy=queryExecutionPlan.root.getDependent(0).deepcopy();
  queryExecutionPlan.compress();
  SelectQuery compressed=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("String_Node_Str","String_Node_Str","String_Node_Str"));
  compressed.setAliasName("String_Node_Str");
  assertEquals(queryExecutionPlan.root.selectQuery.getFromList().get(0),compressed);
  assertEquals(queryExecutionPlan.root.dependents.get(0),asyncAggExecutionNode);
  assertEquals(copy.dependents.get(0),queryExecutionPlan.root.dependents.get(0));
}

Fixed version (ground truth):
@Test public void NestedAggregateWithScrambleTableHavingCommonChildrenTest() throws VerdictDBException {
  String sql="String_Node_Str";
  NonValidatingSQLParser sqlToRelation=new NonValidatingSQLParser();
  SelectQuery selectQuery=(SelectQuery)sqlToRelation.toRelation(sql);
  QueryExecutionPlan queryExecutionPlan=new QueryExecutionPlan(newSchema,null,selectQuery);
  BaseTable base=new BaseTable(originalSchema,originalTable,"String_Node_Str");
  SelectQuery leftQuery=SelectQuery.create(new AliasedColumn(ColumnOp.count(),"String_Node_Str"),base);
  leftQuery.addFilterByAnd(ColumnOp.lessequal(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf(5.0)));
  SelectQuery rightQuery=SelectQuery.create(new AliasedColumn(ColumnOp.count(),"String_Node_Str"),base);
  rightQuery.addFilterByAnd(ColumnOp.greater(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf(5.0)));
  AggExecutionNode leftNode=AggExecutionNode.create(null,leftQuery);
  AggExecutionNode rightNode=AggExecutionNode.create(null,rightQuery);
  ExecutionTokenQueue queue=new ExecutionTokenQueue();
  AggCombinerExecutionNode combiner=AggCombinerExecutionNode.create(queryExecutionPlan,leftNode,rightNode);
  combiner.addBroadcastingQueue(queue);
  AsyncAggExecutionNode asyncAggExecutionNode=AsyncAggExecutionNode.create(null,Arrays.<QueryExecutionNode>asList(leftNode,rightNode),Arrays.<QueryExecutionNode>asList(combiner));
  queryExecutionPlan.root.dependents.get(0).getDependents().remove(0);
  queryExecutionPlan.root.dependents.get(0).getListeningQueues().remove(0);
  ExecutionTokenQueue q=new ExecutionTokenQueue();
  queryExecutionPlan.root.dependents.get(0).getListeningQueues().add(q);
  asyncAggExecutionNode.addBroadcastingQueue(q);
  queryExecutionPlan.root.dependents.get(0).addDependency(asyncAggExecutionNode);
  SelectQuery commonQuery=SelectQuery.create(new AliasedColumn(ColumnOp.count(),"String_Node_Str"),base);
  rightQuery.addFilterByAnd(ColumnOp.greater(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf(5.0)));
  AggExecutionNode common=AggExecutionNode.create(null,commonQuery);
  leftQuery.addFilterByAnd(ColumnOp.lessequal(new BaseColumn("String_Node_Str","String_Node_Str"),ConstantColumn.valueOf(5.0)));
  leftNode.addDependency(common);
  common.addBroadcastingQueue(leftNode.generateListeningQueue());
  rightNode.addDependency(common);
  common.addBroadcastingQueue(rightNode.generateListeningQueue());
  QueryExecutionNode copy=queryExecutionPlan.root.getDependent(0).deepcopy();
  queryExecutionPlan.compress();
  SelectQuery compressed=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("String_Node_Str","String_Node_Str","String_Node_Str"));
  compressed.setAliasName("String_Node_Str");
  assertEquals(queryExecutionPlan.root.selectQuery.getFromList().get(0),compressed);
  assertEquals(queryExecutionPlan.root.dependents.get(0),asyncAggExecutionNode);
  assertEquals(copy.dependents.get(0),queryExecutionPlan.root.dependents.get(0));
}