Program: 50981
Project: 50981
Buggy source:
/** 
 * Loads data for all the segments of the GroupingSets. If the grouping sets list contains more than one Grouping Set then data is loaded using the GROUP BY GROUPING SETS sql. Else if only one grouping set is passed in the list data is loaded without using GROUP BY GROUPING SETS sql. If the database does not support grouping sets  {@link mondrian.spi.Dialect#supportsGroupingSets()} thengrouping sets list should always have only one element in it. <p>For example, if list has 2 grouping sets with columns A, B, C and B, C respectively, then the SQL will be "GROUP BY GROUPING SETS ((A, B, C), (B, C))". <p>Else if the list has only one grouping set then sql would be without grouping sets. <p>The <code>groupingSets</code> list should be topological order, with more detailed higher-level grouping sets occurring first. In other words, the first element of the list should always be the detailed grouping set (default grouping set), followed by grouping sets which can be rolled-up on this detailed grouping set. In the example (A, B, C) is the detailed grouping set and (B, C) is rolled-up using the detailed. <p>Grouping sets are removed from the  {@code groupingSets} list as theyare loaded.</p>
 * @param cellRequestCount Number of missed cells that led to this request
 * @param groupingSets   List of grouping sets whose segments are loaded
 * @param compoundPredicateList Compound predicates
 * @param segmentFutures List of futures wherein each statement will placea list of the segments it has loaded, when it completes
 */
public void load(int cellRequestCount,List<GroupingSet> groupingSets,List<StarPredicate> compoundPredicateList,List<Future<Map<Segment,SegmentWithData>>> segmentFutures){
  for (  GroupingSet groupingSet : groupingSets) {
    for (    Segment segment : groupingSet.getSegments()) {
      cacheMgr.segmentIndex.add(segment.getHeader(),new SlotFuture<SegmentBody>(),new SegmentBuilder.StarSegmentConverter(segment.measure,compoundPredicateList));
    }
  }
  try {
    segmentFutures.add(cacheMgr.sqlExecutor.submit(new SegmentLoadCommand(Locus.peek(),this,cellRequestCount,groupingSets,compoundPredicateList)));
  }
 catch (  Exception e) {
    throw new MondrianException(e);
  }
}

Fixed version (ground truth):
/** 
 * Loads data for all the segments of the GroupingSets. If the grouping sets list contains more than one Grouping Set then data is loaded using the GROUP BY GROUPING SETS sql. Else if only one grouping set is passed in the list data is loaded without using GROUP BY GROUPING SETS sql. If the database does not support grouping sets  {@link mondrian.spi.Dialect#supportsGroupingSets()} thengrouping sets list should always have only one element in it. <p>For example, if list has 2 grouping sets with columns A, B, C and B, C respectively, then the SQL will be "GROUP BY GROUPING SETS ((A, B, C), (B, C))". <p>Else if the list has only one grouping set then sql would be without grouping sets. <p>The <code>groupingSets</code> list should be topological order, with more detailed higher-level grouping sets occurring first. In other words, the first element of the list should always be the detailed grouping set (default grouping set), followed by grouping sets which can be rolled-up on this detailed grouping set. In the example (A, B, C) is the detailed grouping set and (B, C) is rolled-up using the detailed. <p>Grouping sets are removed from the  {@code groupingSets} list as theyare loaded.</p>
 * @param cellRequestCount Number of missed cells that led to this request
 * @param groupingSets   List of grouping sets whose segments are loaded
 * @param compoundPredicateList Compound predicates
 * @param segmentFutures List of futures wherein each statement will placea list of the segments it has loaded, when it completes
 */
public void load(int cellRequestCount,List<GroupingSet> groupingSets,List<StarPredicate> compoundPredicateList,List<Future<Map<Segment,SegmentWithData>>> segmentFutures){
  for (  GroupingSet groupingSet : groupingSets) {
    for (    Segment segment : groupingSet.getSegments()) {
      cacheMgr.segmentIndex.add(segment.getHeader(),true,new SegmentBuilder.StarSegmentConverter(segment.measure,compoundPredicateList));
    }
  }
  try {
    segmentFutures.add(cacheMgr.sqlExecutor.submit(new SegmentLoadCommand(Locus.peek(),this,cellRequestCount,groupingSets,compoundPredicateList)));
  }
 catch (  Exception e) {
    throw new MondrianException(e);
  }
}