Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #ifndef TPCCGENERATED_HPP_
  2. #define TPCCGENERATED_HPP_
  3.  
  4. #include <iostream>
  5. #include <set>
  6. #include <tuple>
  7.  
  8. #include <tbb/concurrent_unordered_map.h>
  9. #include <tbb/blocked_range.h>
  10. #include <tbb/parallel_for.h>
  11.  
  12. #include "../helper/helper.hpp"
  13. #include "../type/Types.hpp"
  14. #include "../type/tpcc_schema.hpp"
  15. #include "../storage/RowStore.hpp"
  16.  
  17. // THIS METHOD EXECUTES THE QUERY
  18. extern "C" {
  19. void run(Database *db) {
  20.     std::cout << "   c_id   |    w_id   |" << std::endl;
  21.     std::cout
  22.             << "--------------------------------------------------------------------------"
  23.             << std::endl;
  24.     typedef Integer join_attr_0;
  25.     typedef Integer store_attr_0;
  26.     tbb::concurrent_unordered_map<join_attr_0,
  27.             tbb::concurrent_vector<store_attr_0>, std::hash<join_attr_0>> ht_0;
  28.     tbb::parallel_for(size_t(0), size_t(db->customer->size() - 1),
  29.             [&] (size_t index) {
  30.                 auto i_0 = db->customer->getByTid(index);
  31.                 ht_0[i_0.c_w_id].push_back(i_0.c_id);
  32.             });
  33.     tbb::parallel_for(size_t(0), size_t(db->warehouse->size() - 1),
  34.             [&] (size_t index) {
  35.                 auto i_1 = db->warehouse->getByTid(index);
  36.                 for (store_attr_0 hx_0 : ht_0[i_1.w_id]) {
  37.                     std::cout << "  " << hx_0 << "  |" << " " << i_1.w_id << "  |" << std::endl;
  38.                 }
  39.             });
  40.  
  41.     std::cout << std::endl << std::endl;
  42.  
  43. }
  44. }
  45. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement