diff --git a/.gitignore b/.gitignore index 2894de7..2bfc404 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,8 @@ server/packages/** *.stackdump saves *.exe +out*.cpp +udf*.hpp + + + diff --git a/Makefile b/Makefile index 022c4d8..476ec61 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ ifeq ($(OS),Windows_NT) OS_SUPPORT += server/winhelper.cpp MonetDB_LIB += -Imonetdb/msvc msc-plugin/monetdbe.dll else - MonetDB_LIB += -lmonetdbe + MonetDB_LIB += -I/usr/include/monetdb -lmonetdbe endif info: diff --git a/out.cpp b/out.cpp deleted file mode 100644 index 1320768..0000000 --- a/out.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "./server/libaquery.h" -#include -#include "./server/monetdb_conn.h" -#include "./server/hasher.h" -#include "./server/aggregations.h" -__AQEXPORT__(int) dll_3V1c8v(Context* cxt) { - using namespace std; - using namespace types; - auto server = static_cast(cxt->alt_server); -auto len_5Bixfq = server->cnt; -auto mont_1Mz = ColRef(len_5Bixfq, server->getCol(0)); -auto sales_2DN = ColRef(len_5Bixfq, server->getCol(1)); -auto out_5Ffhnc = new TableInfo("out_5Ffhnc"); -out_5Ffhnc->get_col<0>().initfrom(mont_1Mz); -out_5Ffhnc->get_col<1>() = avgw(3, sales_2DN); -print(*out_5Ffhnc); -FILE* fp_57Mh6f = fopen("moving_avg_output.csv", "w"); -out_5Ffhnc->printall(";", "\n", nullptr, fp_57Mh6f); -fclose(fp_57Mh6f); -puts("done."); -return 0; -} -__AQEXPORT__(int) dll_frRsQ7(Context* cxt) { - using namespace std; - using namespace types; - auto server = static_cast(cxt->alt_server); -auto len_5JydG3 = server->cnt; -auto mont_34m = ColRef(len_5JydG3, server->getCol(0)); -auto sales_4wo = ColRef(len_5JydG3, server->getCol(1)); -auto out_4Fsh6O = new TableInfo>("out_4Fsh6O"); -decltype(auto) col_4A04Hh = out_4Fsh6O->get_col<0>(); -decltype(auto) col_1S5CS2 = out_4Fsh6O->get_col<1>(); -auto t4HUjxwQ = mont_34m; -typedef record> record_type5PGugsV; -unordered_map, transTypes> g6HIDqpq; -for (uint32_t ilq = 0; ilq < t4HUjxwQ.size; ++ilq){ -g6HIDqpq[forward_as_tuple(t4HUjxwQ[ilq])].emplace_back(ilq); -} -for (auto& i2M : g6HIDqpq) { -auto &key_5JcLJMV = i2M.first; -auto &val_yqDe0lt = i2M.second; -col_4A04Hh.emplace_back(get<0>(key_5JcLJMV)); - -col_1S5CS2.emplace_back(minw(2, sales_4wo[val_yqDe0lt])); - -} -print(*out_4Fsh6O); -FILE* fp_6UC6Yg = fopen("flatten.csv", "w"); -out_4Fsh6O->printall(",", "\n", nullptr, fp_6UC6Yg); -fclose(fp_6UC6Yg); -puts("done."); -return 0; -} \ No newline at end of file diff --git a/server/io.h b/server/io.h index 4f7e01a..2c5c413 100644 --- a/server/io.h +++ b/server/io.h @@ -3,6 +3,7 @@ #include #include #include +#include template std::string generate_printf_string(const char* sep = " ", const char* end = "\n") { std::string str; diff --git a/server/monetdb_conn.h b/server/monetdb_conn.h index c543437..4be30a0 100644 --- a/server/monetdb_conn.h +++ b/server/monetdb_conn.h @@ -1,8 +1,4 @@ -#ifdef _WIN32 - #include "monetdbe.h" -#else - #include "monetdb/monetdbe.h" -#endif +#include "monetdbe.h" struct Context; diff --git a/server/winhelper.cpp b/server/winhelper.cpp index fd534bf..21c8a27 100644 --- a/server/winhelper.cpp +++ b/server/winhelper.cpp @@ -1,3 +1,4 @@ +#ifdef _WIN32 #include "winhelper.h" #include @@ -33,4 +34,5 @@ void SharedMemory::FreeMemoryMap() UnmapViewOfFile(this->pData); if (this->hFileMap) CloseHandle(this->hFileMap); -} \ No newline at end of file +} +#endif diff --git a/server/winhelper.h b/server/winhelper.h index 6ff22a6..5993943 100644 --- a/server/winhelper.h +++ b/server/winhelper.h @@ -1,5 +1,6 @@ #ifndef _WINHELPER_H #define _WINHELPER_H +#ifdef _WIN32 static constexpr int RTLD_LAZY = 1; void* dlopen(const char*, int); void* dlsym(void*, const char*); @@ -12,3 +13,4 @@ struct SharedMemory void FreeMemoryMap(); }; #endif +#endif diff --git a/udf.hpp b/udf.hpp deleted file mode 100644 index 271299d..0000000 --- a/udf.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once -#include "./server/libaquery.h" -#include "./server/aggregations.h" - -auto covariances2 = [](auto x, auto y, auto w, uint32_t _builtin_len, auto& _builtin_ret) { - auto xmeans = 0.0; - auto ymeans = 0.0; - auto l = _builtin_len; - if((l > 0)) { - xmeans = x[0]; - ymeans = y[0]; - _builtin_ret[0] = 0.0; - } - if((w > l)) - w = l; - for(auto i = 1, j = 0; (i < w); i = (i + 1)) { - xmeans += x[i]; - ymeans += y[i]; - _builtin_ret[i] = avg(((x.subvec(0, i) - (xmeans / i)) * (y.subvec(0, i) - (ymeans / i)))); - } - xmeans /= w; - ymeans /= w; - for(auto i = w; (i < l); i += 1) { - xmeans += ((x[i] - x[(i - w)]) / w); - ymeans += ((y[i] - y[(i - w)]) / w); - _builtin_ret[i] = avg(((x.subvec((i - w), i) - xmeans) * (y.subvec((i - w), i) - ymeans))); - } - return ; -}; - -auto covariances2_gettype = [](auto x, auto y, auto w) { - uint32_t _builtin_len = 0; - auto xmeans = 0.0; - auto ymeans = 0.0; - auto l = _builtin_len; - if((l > 0)) { - xmeans = x[0]; - ymeans = y[0]; - return 0.0; - } - if((w > l)) - w = l; - for(auto i = 1, j = 0; (i < w); i = (i + 1)) { - xmeans += x[i]; - ymeans += y[i]; - return avg(((x.subvec(0, i) - (xmeans / i)) * (y.subvec(0, i) - (ymeans / i)))); - } - xmeans /= w; - ymeans /= w; - for(auto i = w; (i < l); i += 1) { - xmeans += ((x[i] - x[(i - w)]) / w); - ymeans += ((y[i] - y[(i - w)]) / w); - return avg(((x.subvec((i - w), i) - xmeans) * (y.subvec((i - w), i) - ymeans))); - } -}; -