anchor.diff:  subqueries_done(QId,
                   #state{qid          = QId,
                          receiver_pid = ReceiverPid,
  -                       result       = QueryResult1,
  -                       sub_qrys     = SubQQ,
  -                       qry          = ?SQL_SELECT{'SELECT' = Sel }} = State) ->
  +                       sub_qrys     = SubQQ} = State) ->
       case SubQQ of
           [] ->
  -            QueryResult2 = prepare_final_results(Sel, QueryResult1),
  +            QueryResult2 = prepare_final_results(State),
               %   send the results to the waiting client process
               ReceiverPid ! {ok, QueryResult2},
               pop_next_query(),
  
positive.code:               State#state{status   = accumulating_chunks,
                            result   = QueryResult2,
                            sub_qrys = NSubQ}
  
              catch
                error:divide_by_zero ->
                    cancel_error_query(divide_by_zero, State)
  
negative.code: 
  prepare_final_results_test() ->
      Rows = [[12, <<"windy">>], [13, <<"windy">>]],
      % IndexedChunks = [{1, Rows}],
      ?assertEqual(
          {[<<"a">>, <<"b">>], [sint64, varchar], Rows},
          prepare_final_results(
              #state{
                  qry =
                      ?SQL_SELECT{
                          'SELECT' = #riak_sel_clause_v1{
                              col_names = [<<"a">>, <<"b">>],
                              col_return_types = [sint64, varchar],
                              calc_type = rows
                           }
                      },
                  result = [{1, Rows}]})
      ).
  
  -endif.
  