diff --git a/Makefile b/Makefile index de4a904..9c10283 100644 --- a/Makefile +++ b/Makefile @@ -12,4 +12,4 @@ server.so: snippet: g++ -shared -fPIC --std=c++1z out.cpp -O3 -march=native -o dll.so clean: - rm *.shm -rf \ No newline at end of file + rm *.shm -rf diff --git a/out.cpp b/out.cpp index 768a22d..2cb8e2b 100644 --- a/out.cpp +++ b/out.cpp @@ -1,8 +1,8 @@ #include "./server/aggregations.h" +#include #include "csv.h" -#include "./server/libaquery.h" #include "./server/hasher.h" -#include +#include "./server/libaquery.h" extern "C" int __DLLEXPORT__ dllmain(Context* cxt) { using namespace std; @@ -18,40 +18,40 @@ test_a.init("a"); test_b.init("b"); test_c.init("c"); test_d.init("d"); -io::CSVReader<4> csv_reader_1qh80y("test.csv"); -csv_reader_1qh80y.read_header(io::ignore_extra_column, "a","b","c","d"); -int tmp_6JfuovoZ; -int tmp_4B4ADRgW; -int tmp_3JHd3elW; -int tmp_1heR8kZw; -while(csv_reader_1qh80y.read_row(tmp_6JfuovoZ,tmp_4B4ADRgW,tmp_3JHd3elW,tmp_1heR8kZw)) { +io::CSVReader<4> csv_reader_6pX2fy("test.csv"); +csv_reader_6pX2fy.read_header(io::ignore_extra_column, "a","b","c","d"); +int tmp_1E7DxvaO; +int tmp_5JwTTT4O; +int tmp_3gbplDAu; +int tmp_XK4BgA6z; +while(csv_reader_6pX2fy.read_row(tmp_1E7DxvaO,tmp_5JwTTT4O,tmp_3gbplDAu,tmp_XK4BgA6z)) { -test_a.emplace_back(tmp_6JfuovoZ); -test_b.emplace_back(tmp_4B4ADRgW); -test_c.emplace_back(tmp_3JHd3elW); -test_d.emplace_back(tmp_1heR8kZw); +test_a.emplace_back(tmp_1E7DxvaO); +test_b.emplace_back(tmp_5JwTTT4O); +test_c.emplace_back(tmp_3gbplDAu); +test_d.emplace_back(tmp_XK4BgA6z); } -typedef record record_type3he5qd1; -unordered_map, transTypes> g59vWI2v; -for (uint32_t i3P = 0; i3P < test_a.size; ++i3P){ -g59vWI2v[forward_as_tuple(test_a[i3P],test_b[i3P],test_d[i3P])].emplace_back(i3P); +typedef record record_type61iBrX3; +unordered_map, transTypes> g7sUysrP; +for (uint32_t i2I = 0; i2I < test_a.size; ++i2I){ +g7sUysrP[forward_as_tuple(test_a[i2I],test_b[i2I],test_d[i2I])].emplace_back(i2I); } -auto out_6JAp = new TableInfo,value_type>,value_type>>("out_6JAp", 3); -cxt->tables.insert({"out_6JAp", out_6JAp}); -auto& out_6JAp_sumtestc = *(ColRef> *)(&out_6JAp->colrefs[0]); -auto& out_6JAp_b = *(ColRef>> *)(&out_6JAp->colrefs[1]); -auto& out_6JAp_d = *(ColRef>> *)(&out_6JAp->colrefs[2]); -out_6JAp_sumtestc.init("sumtestc"); -out_6JAp_b.init("b"); -out_6JAp_d.init("d"); -for(auto& i2Y : g59vWI2v) { -auto &key_1yBYhdd = i2Y.first; -auto &val_61QXy6G = i2Y.second; -out_6JAp_sumtestc.emplace_back(sum(test_c[val_61QXy6G])); -out_6JAp_b.emplace_back(get<1>(key_1yBYhdd)); -out_6JAp_d.emplace_back(get<2>(key_1yBYhdd)); +auto out_1SHu = new TableInfo,value_type>,value_type>>("out_1SHu", 3); +cxt->tables.insert({"out_1SHu", out_1SHu}); +auto& out_1SHu_sumtestc = *(ColRef> *)(&out_1SHu->colrefs[0]); +auto& out_1SHu_b = *(ColRef>> *)(&out_1SHu->colrefs[1]); +auto& out_1SHu_d = *(ColRef>> *)(&out_1SHu->colrefs[2]); +out_1SHu_sumtestc.init("sumtestc"); +out_1SHu_b.init("b"); +out_1SHu_d.init("d"); +for(auto& i64 : g7sUysrP) { +auto &key_645kbJO = i64.first; +auto &val_1UnUa89 = i64.second; +out_1SHu_sumtestc.emplace_back(sum(test_c[val_1UnUa89])); +out_1SHu_b.emplace_back(get<1>(key_645kbJO)); +out_1SHu_d.emplace_back(get<2>(key_645kbJO)); } -auto d1dyPtv0 = out_6JAp->order_by_view<-3,1>(); -print(d1dyPtv0); +auto d6tAcglo = out_1SHu->order_by_view<-3,1>(); +print(d6tAcglo); return 0; } \ No newline at end of file diff --git a/server/server.cpp b/server/server.cpp index 350035c..23d0ccf 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -35,7 +35,7 @@ void daemon(thread_context* c) { } #include "aggregations.h" typedef int (*code_snippet)(void*); -int _main(); +int test_main(); int dll_main(int argc, char** argv, Context* cxt){ Config *cfg = reinterpret_cast(argv[0]); @@ -52,7 +52,7 @@ int dll_main(int argc, char** argv, Context* cxt){ while(cfg->running){ if (cfg->new_query) { - void* handle = dlopen("d:/gg/Aquery++/dll.so", RTLD_LAZY); + void* handle = dlopen("./dll.so", RTLD_LAZY); code_snippet c = reinterpret_cast(dlsym(handle, "dllmain")); c(cxt); dlclose(handle);