-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjoin_aggregate.cpp
More file actions
31 lines (23 loc) · 980 Bytes
/
join_aggregate.cpp
File metadata and controls
31 lines (23 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2021-2023 Institute of Computing Technology, Chinese Academy of Sciences
// DIM3 is licensed under Mulan PSL v2.
#include"dim3.hpp"
myvector<TUPLE<int, int, float>> R, S, result;
/*
for table R(int x, int y, float v) and S(int z, int y, float v),
we want to calculate SQL:
SELECT R.x,S.z,avg(R.v+S.v)
FROM R,S
WHERE R.y=S.y
*/
int main(int argc, char* argv[]) {
gen_rand_data(R,S);
result.clear();
chrono::high_resolution_clock::time_point startTime = chrono::high_resolution_clock::now();
DIM3JoinAggregate<int, int, int, float, AggregateFunctionAvg<float>,
myHasher, myHasher, myHasher, myHasher, uint32_t>
::doJoinAggregate(R, S, result);
chrono::high_resolution_clock::time_point endTime = chrono::high_resolution_clock::now();
printf("It takes %f seconds.\n", chrono::duration<double, std::ratio<1, 1>>(endTime - startTime).count());
printf("|Result|=%u\n", result.size());
return 0;
}