parent
ae51d8c622
commit
d1a6b1d83f
@ -1,60 +1,56 @@
|
||||
#include "./server/aggregations.h"
|
||||
#include "csv.h"
|
||||
#include <unordered_map>
|
||||
#include "./server/libaquery.h"
|
||||
#include "./server/hasher.h"
|
||||
#include "./server/aggregations.h"
|
||||
|
||||
extern "C" int __DLLEXPORT__ dllmain(Context* cxt) {
|
||||
using namespace std;
|
||||
using namespace types;
|
||||
auto stocks = new TableInfo<int,int>("stocks", 2);
|
||||
cxt->tables.insert({"stocks", stocks});
|
||||
auto& stocks_timestamp = *(ColRef<int> *)(&stocks->colrefs[0]);
|
||||
auto& stocks_price = *(ColRef<int> *)(&stocks->colrefs[1]);
|
||||
stocks_timestamp.init();
|
||||
stocks_price.init();
|
||||
stocks_timestamp.emplace_back(1);
|
||||
stocks_price.emplace_back(15);
|
||||
stocks_timestamp.emplace_back(2);
|
||||
stocks_price.emplace_back(19);
|
||||
stocks_timestamp.emplace_back(3);
|
||||
stocks_price.emplace_back(16);
|
||||
stocks_timestamp.emplace_back(4);
|
||||
stocks_price.emplace_back(17);
|
||||
stocks_timestamp.emplace_back(5);
|
||||
stocks_price.emplace_back(15);
|
||||
stocks_timestamp.emplace_back(6);
|
||||
stocks_price.emplace_back(13);
|
||||
stocks_timestamp.emplace_back(7);
|
||||
stocks_price.emplace_back(5);
|
||||
stocks_timestamp.emplace_back(8);
|
||||
stocks_price.emplace_back(8);
|
||||
stocks_timestamp.emplace_back(9);
|
||||
stocks_price.emplace_back(7);
|
||||
stocks_timestamp.emplace_back(10);
|
||||
stocks_price.emplace_back(13);
|
||||
stocks_timestamp.emplace_back(11);
|
||||
stocks_price.emplace_back(11);
|
||||
stocks_timestamp.emplace_back(12);
|
||||
stocks_price.emplace_back(14);
|
||||
stocks_timestamp.emplace_back(13);
|
||||
stocks_price.emplace_back(10);
|
||||
stocks_timestamp.emplace_back(14);
|
||||
stocks_price.emplace_back(5);
|
||||
stocks_timestamp.emplace_back(15);
|
||||
stocks_price.emplace_back(2);
|
||||
stocks_timestamp.emplace_back(16);
|
||||
stocks_price.emplace_back(5);
|
||||
auto out_ZPYh = new TableInfo<decays<decltype(max((stocks_price[0]-min(stocks_timestamp[0]))))>>("out_ZPYh", 1);
|
||||
cxt->tables.insert({"out_ZPYh", out_ZPYh});
|
||||
auto& out_ZPYh_maxstockspriceminstockstimestamp = *(ColRef<decays<decltype(max((stocks_price[0]-min(stocks_timestamp[0]))))>> *)(&out_ZPYh->colrefs[0]);
|
||||
out_ZPYh_maxstockspriceminstockstimestamp.init();
|
||||
out_ZPYh_maxstockspriceminstockstimestamp = max((stocks_price-min(stocks_timestamp)));
|
||||
print(*out_ZPYh);
|
||||
auto test = new TableInfo<int,int,int,int>("test", 4);
|
||||
cxt->tables.insert({"test", test});
|
||||
auto& test_a = *(ColRef<int> *)(&test->colrefs[0]);
|
||||
auto& test_b = *(ColRef<int> *)(&test->colrefs[1]);
|
||||
auto& test_c = *(ColRef<int> *)(&test->colrefs[2]);
|
||||
auto& test_d = *(ColRef<int> *)(&test->colrefs[3]);
|
||||
test_a.init();
|
||||
test_b.init();
|
||||
test_c.init();
|
||||
test_d.init();
|
||||
io::CSVReader<4> csv_reader_6qlGpe("test.csv");
|
||||
csv_reader_6qlGpe.read_header(io::ignore_extra_column, "a","b","c","d");
|
||||
int tmp_39gHMkie;
|
||||
int tmp_190h2sZs;
|
||||
int tmp_4a8dDzSN;
|
||||
int tmp_3LAKxSmM;
|
||||
while(csv_reader_6qlGpe.read_row(tmp_39gHMkie,tmp_190h2sZs,tmp_4a8dDzSN,tmp_3LAKxSmM)) {
|
||||
|
||||
auto out_1ac3 = new TableInfo<decays<decltype(max((stocks_price[0]-mins(stocks_price[0]))))>>("out_1ac3", 1);
|
||||
cxt->tables.insert({"out_1ac3", out_1ac3});
|
||||
auto& out_1ac3_maxstockspriceminsstocksprice = *(ColRef<decays<decltype(max((stocks_price[0]-mins(stocks_price[0]))))>> *)(&out_1ac3->colrefs[0]);
|
||||
out_1ac3_maxstockspriceminsstocksprice.init();
|
||||
out_1ac3_maxstockspriceminsstocksprice = max((stocks_price-mins(stocks_price)));
|
||||
print(*out_1ac3);
|
||||
test_a.emplace_back(tmp_39gHMkie);
|
||||
test_b.emplace_back(tmp_190h2sZs);
|
||||
test_c.emplace_back(tmp_4a8dDzSN);
|
||||
test_d.emplace_back(tmp_3LAKxSmM);
|
||||
}
|
||||
typedef record<decltype(test_a[0]),decltype(test_b[0]),decltype(test_d[0])> record_type2Te4GFo;
|
||||
unordered_map<record_type2Te4GFo, vector_type<uint32_t>, transTypes<record_type2Te4GFo, hasher>> g79JNXM8;
|
||||
for (uint32_t i5x = 0; i5x < test_a.size; ++i5x){
|
||||
g79JNXM8[forward_as_tuple(test_a[i5x],test_b[i5x],test_d[i5x])].emplace_back(i5x);
|
||||
}
|
||||
auto out_5NL7 = new TableInfo<decays<decltype(sum(test_c[0]))>,decays<decltype(test_b[0])>,decays<decltype(test_d[0])>>("out_5NL7", 3);
|
||||
cxt->tables.insert({"out_5NL7", out_5NL7});
|
||||
auto& out_5NL7_sumtestc = *(ColRef<decays<decltype(sum(test_c[0]))>> *)(&out_5NL7->colrefs[0]);
|
||||
auto& out_5NL7_get1None = *(ColRef<decays<decltype(test_b[0])>> *)(&out_5NL7->colrefs[1]);
|
||||
auto& out_5NL7_get2None = *(ColRef<decays<decltype(test_d[0])>> *)(&out_5NL7->colrefs[2]);
|
||||
out_5NL7_sumtestc.init();
|
||||
out_5NL7_get1None.init();
|
||||
out_5NL7_get2None.init();
|
||||
for(auto& i4l : g79JNXM8) {
|
||||
auto &key_ADPihOU = i4l.first;
|
||||
auto &val_7LsrkDP = i4l.second;
|
||||
out_5NL7_sumtestc.emplace_back(sum(test_c[val_7LsrkDP]));
|
||||
out_5NL7_get1None.emplace_back(get<1>(key_ADPihOU));
|
||||
out_5NL7_get2None.emplace_back(get<2>(key_ADPihOU));
|
||||
}
|
||||
print(*out_5NL7);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in new issue