-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.cpp
More file actions
36 lines (36 loc) · 1.17 KB
/
Utils.cpp
File metadata and controls
36 lines (36 loc) · 1.17 KB
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
32
33
34
35
36
#include <iostream>
#include "Utils.hpp"
//---------------------------------------------------------------------------
using namespace std;
//---------------------------------------------------------------------------
static void createColumn(vector<uint64_t*>& columns,uint64_t numTuples)
// Create a dummy column
{
auto col=new uint64_t[numTuples];
columns.push_back(col);
for (unsigned i=0;i<numTuples;++i) {
col[i]=i;
}
}
//---------------------------------------------------------------------------
Relation Utils::createRelation(uint64_t size,uint64_t numColumns)
// Create a dummy relation
{
vector<uint64_t*> columns;
for (unsigned i=0;i<numColumns;++i) {
createColumn(columns,size);
}
return Relation(size,move(columns));
}
//---------------------------------------------------------------------------
void Utils::storeRelation(ofstream& out,Relation& r,unsigned i)
// Store a relation in all formats
{
auto baseName = "r" + to_string(i);
r.storeRelation(baseName);
r.storeRelationCSV(baseName);
r.dumpSQL(baseName, i);
cout << baseName << "\n";
out << baseName << "\n";
}
//---------------------------------------------------------------------------