parent
ae51d8c622
commit
d1a6b1d83f
@ -1,60 +1,56 @@
|
|||||||
#include "./server/aggregations.h"
|
#include "csv.h"
|
||||||
|
#include <unordered_map>
|
||||||
#include "./server/libaquery.h"
|
#include "./server/libaquery.h"
|
||||||
|
#include "./server/hasher.h"
|
||||||
|
#include "./server/aggregations.h"
|
||||||
|
|
||||||
extern "C" int __DLLEXPORT__ dllmain(Context* cxt) {
|
extern "C" int __DLLEXPORT__ dllmain(Context* cxt) {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace types;
|
using namespace types;
|
||||||
auto stocks = new TableInfo<int,int>("stocks", 2);
|
auto test = new TableInfo<int,int,int,int>("test", 4);
|
||||||
cxt->tables.insert({"stocks", stocks});
|
cxt->tables.insert({"test", test});
|
||||||
auto& stocks_timestamp = *(ColRef<int> *)(&stocks->colrefs[0]);
|
auto& test_a = *(ColRef<int> *)(&test->colrefs[0]);
|
||||||
auto& stocks_price = *(ColRef<int> *)(&stocks->colrefs[1]);
|
auto& test_b = *(ColRef<int> *)(&test->colrefs[1]);
|
||||||
stocks_timestamp.init();
|
auto& test_c = *(ColRef<int> *)(&test->colrefs[2]);
|
||||||
stocks_price.init();
|
auto& test_d = *(ColRef<int> *)(&test->colrefs[3]);
|
||||||
stocks_timestamp.emplace_back(1);
|
test_a.init();
|
||||||
stocks_price.emplace_back(15);
|
test_b.init();
|
||||||
stocks_timestamp.emplace_back(2);
|
test_c.init();
|
||||||
stocks_price.emplace_back(19);
|
test_d.init();
|
||||||
stocks_timestamp.emplace_back(3);
|
io::CSVReader<4> csv_reader_6qlGpe("test.csv");
|
||||||
stocks_price.emplace_back(16);
|
csv_reader_6qlGpe.read_header(io::ignore_extra_column, "a","b","c","d");
|
||||||
stocks_timestamp.emplace_back(4);
|
int tmp_39gHMkie;
|
||||||
stocks_price.emplace_back(17);
|
int tmp_190h2sZs;
|
||||||
stocks_timestamp.emplace_back(5);
|
int tmp_4a8dDzSN;
|
||||||
stocks_price.emplace_back(15);
|
int tmp_3LAKxSmM;
|
||||||
stocks_timestamp.emplace_back(6);
|
while(csv_reader_6qlGpe.read_row(tmp_39gHMkie,tmp_190h2sZs,tmp_4a8dDzSN,tmp_3LAKxSmM)) {
|
||||||
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 out_1ac3 = new TableInfo<decays<decltype(max((stocks_price[0]-mins(stocks_price[0]))))>>("out_1ac3", 1);
|
test_a.emplace_back(tmp_39gHMkie);
|
||||||
cxt->tables.insert({"out_1ac3", out_1ac3});
|
test_b.emplace_back(tmp_190h2sZs);
|
||||||
auto& out_1ac3_maxstockspriceminsstocksprice = *(ColRef<decays<decltype(max((stocks_price[0]-mins(stocks_price[0]))))>> *)(&out_1ac3->colrefs[0]);
|
test_c.emplace_back(tmp_4a8dDzSN);
|
||||||
out_1ac3_maxstockspriceminsstocksprice.init();
|
test_d.emplace_back(tmp_3LAKxSmM);
|
||||||
out_1ac3_maxstockspriceminsstocksprice = max((stocks_price-mins(stocks_price)));
|
}
|
||||||
print(*out_1ac3);
|
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;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in new issue