code: private void mergeAndReturnResults() {
      final long hbase_time = DateTime.currentTimeMillis();
      TsdbQuery.scanlatency.add((int)(hbase_time - start_time));
      
      if (exception != null) {
        LOG.error("After all of the scanners finished, at "
            + "least one threw an exception", exception);
        results.callback(exception);
        return;
      }
      
      final long merge_start = DateTime.nanoTime();
      //Merge sorted spans together
      if (!isHistogramScan()) {
        mergeDataPoints();
      } else {
        // Merge histogram data points
        mergeHistogramDataPoints();
      }
  
      if (LOG.isDebugEnabled()) {
        LOG.debug("It took " + (DateTime.currentTimeMillis() - hbase_time) + " ms, "
              + " to merge and sort the rows into a tree map");
      }
  
      if (query_stats != null) {
        query_stats.addStat(query_index, QueryStat.SCANNER_MERGE_TIME, 
            (DateTime.nanoTime() - merge_start));
      }
  
      if (!isHistogramScan()) {
        results.callback(spans);
      } else {
        histogramResults.callback(histSpans);
      }
    }
docs: Called once all of the scanners have reported back in to record our
  latency and merge the results into the spans map. If there was an exception
  stored then we'll return that instead.