Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL correctness fixes and other simplification #91

Merged
merged 28 commits into from
Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a138657
adding ssb load function
srsuryadev Feb 25, 2021
ba8b48d
added ssb query driver
srsuryadev Feb 26, 2021
6121c36
add predicate.h in resolver
srsuryadev Feb 26, 2021
3509468
add the hustle resolver operators
srsuryadev Feb 26, 2021
7f98040
add resolver module in the hustle_src_benchmark
srsuryadev Feb 26, 2021
7318a68
remove sqlite3 header in ssb queries
srsuryadev Feb 26, 2021
d5d8252
pass serial type lens instead of bytewidths
srsuryadev Mar 2, 2021
1456b4d
fix the record read for optimized bytewidth for 0/1
srsuryadev Mar 3, 2021
152179d
resolver fix for support for other agg functions
srsuryadev Mar 3, 2021
790c1fb
SSB Driver fix
srsuryadev Mar 3, 2021
f9d5424
SSB query fixes
srsuryadev Mar 3, 2021
3551a94
remove unused code in hash_aggregate
srsuryadev Mar 3, 2021
32c0011
Lazy table simplification of methods and refactor
srsuryadev Mar 3, 2021
6a485e5
revert the sqlite3 to hustle mode
srsuryadev Mar 4, 2021
8ae8f45
Basic Benchmark test
srsuryadev Mar 4, 2021
5d1a143
callback function support in sql execution for results
srsuryadev Mar 4, 2021
f6cfc87
lazy table fixes on assertion
srsuryadev Mar 4, 2021
dd5e78f
rename and move benchmark test to sql test
srsuryadev Mar 4, 2021
c786ce4
add sql test load
srsuryadev Mar 4, 2021
bbc22e2
Block callback support for results fix
srsuryadev Mar 6, 2021
710b25a
SQL test - end to end
srsuryadev Mar 6, 2021
432887a
add license headers in new files
srsuryadev Mar 6, 2021
bef62f5
move - sql test to diff branch (delete)
srsuryadev Mar 6, 2021
5d065b4
simplification and refactor of code
srsuryadev Mar 6, 2021
95a43de
fixes in the command line
srsuryadev Mar 6, 2021
009c261
Update Readme.md
srsuryadev Mar 6, 2021
09f5b0c
benchmark cmd msg
srsuryadev Mar 6, 2021
e7e48e0
driver reformatting and removing old benchmark code
srsuryadev Mar 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sh ./scripts/ssb/gen_benchmark_data.sh ${SCALE_FACTOR}
To run the ssb benchmark,

```
sh ./scripts/ssb/run_benchmark.sh ssb [arrow_aggregate | hash_aggregate]
sh ./scripts/ssb/run_benchmark.sh ssb_queries
```

To run the tatp benchmark,
Expand Down
3 changes: 2 additions & 1 deletion src/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ target_link_libraries(hustle_hustleDB_test
absl::flat_hash_map
hustleDB
)
add_test(HustleDB_test hustle_hustleDB_test)
add_test(HustleDB_test hustle_hustleDB_test)

2 changes: 1 addition & 1 deletion src/api/tests/hustle_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ TEST(HustleDB, getPlan) {
std::string plan =
hustleDB.getPlan("EXPLAIN QUERY PLAN SELECT c1,c2 FROM Subscriber;");

EXPECT_EQ(plan, "SCAN TABLE Subscriber\n");
EXPECT_EQ(plan, "2 | 0 | 0 | SCAN TABLE Subscriber\n");

std::filesystem::remove_all("db_directory");
}
1 change: 1 addition & 0 deletions src/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ target_include_directories(hustle_src_benchmark PUBLIC ${ARROW_INCLUDE_DIR})
target_link_libraries(hustle_src_benchmark PUBLIC
hustle_src_storage
hustle_src_operators
hustle_src_resolver
hustle_src_scheduler_Scheduler
hustle_src_optimizer_ExecutionPlan
hustle_src_utils_EventProfiler
Expand Down
219 changes: 150 additions & 69 deletions src/benchmark/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#include "aggregate_workload.h"
#include "skew.h"
#include "ssb_workload.h"
#include "ssb_queries.h"
#include "ssb_workload.h"
#include "storage/util.h"
#include "tatp_workload.h"

Expand All @@ -30,6 +30,7 @@ using namespace std::chrono;
#define DEBUG false

SSB *workload;
SSBQueries *ssb_queries;
AggregateWorkload *aggregateWorkload;

void read_from_csv() {
Expand Down Expand Up @@ -217,19 +218,97 @@ static void query43(benchmark::State &state) {
}
}

BENCHMARK(query11);
BENCHMARK(query12);
BENCHMARK(query13);
BENCHMARK(query21);
BENCHMARK(query22);
BENCHMARK(query23);
BENCHMARK(query31);
BENCHMARK(query32);
BENCHMARK(query33);
BENCHMARK(query34);
BENCHMARK(query41);
BENCHMARK(query42);
BENCHMARK(query43);
static void ssb_query11(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q11();
}
}

static void ssb_query12(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q12();
}
}

static void ssb_query13(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q13();
}
}

static void ssb_query21(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q21();
}
}

static void ssb_query22(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q22();
}
}

static void ssb_query23(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q23();
}
}

static void ssb_query31(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q31();
}
}

static void ssb_query32(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q32();
}
}

static void ssb_query33(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q33();
}
}

static void ssb_query34(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q34();
}
}

static void ssb_query41(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q41();
}
}

static void ssb_query42(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q42();
}
}

static void ssb_query43(benchmark::State &state) {
for (auto _ : state) {
ssb_queries->q43();
}
}

BENCHMARK(ssb_query11);
BENCHMARK(ssb_query12);
BENCHMARK(ssb_query13);
BENCHMARK(ssb_query21);
BENCHMARK(ssb_query22);
BENCHMARK(ssb_query23);
BENCHMARK(ssb_query31);
BENCHMARK(ssb_query32);
BENCHMARK(ssb_query33);
BENCHMARK(ssb_query34);
BENCHMARK(ssb_query41);
BENCHMARK(ssb_query42);
BENCHMARK(ssb_query43);

// TODO: Refactor this using C++ command line arg parser.
AggregateType get_agg_type(int argc, char *argv[]) {
Expand Down Expand Up @@ -275,24 +354,27 @@ int get_test(int argc, char *argv[]) {
}
i += 1;
auto v = std::string(argv[i]);
if (v.find("ssb") != ((size_t)-1)) {
if (!v.compare("ssb")) {
bench_type = SSB_WORKLOAD;
std::cout << "Benchmark using SSB workload." << std::endl;
} else if (v.find("tatp") != ((size_t)-1)) {
std::cout << "Please use \"ssb_queries\" instead of \"ssb\"."
<< std::endl;
exit(1);
} else if (!v.compare("tatp")) {
bench_type = TATP_WORKLOAD;
std::cout << "Benchmark using aggregate workload" << std::endl;
} else if (v.find("aggregate") != ((size_t)-1)) {
std::cout << "Benchmark using tatp workload" << std::endl;
} else if (!v.compare("aggregate")) {
bench_type = AGGREGATE_WORKLOAD;
std::cout << "Benchmark using aggregate workload" << std::endl;
} else if (v.find("queries") != ((size_t)-1)) {
bench_type = SSB_QUERIES_WORKLOAD;
std::cout << "Benchmark using aggregate workload" << std::endl;
} else if (!v.compare("ssb_queries")) {
bench_type = SSB_QUERIES_WORKLOAD;
std::cout << "Benchmark using SSB query based workload" << std::endl;
} else {
std::cerr << "Expected --benchmark [ssb | aggregate], got " << v
<< std::endl;
std::cerr
<< "Expected --benchmark [ssb | aggregate | ssb_queries], got " << v
<< std::endl;
exit(1);
}
}
}
}
return bench_type;
}
Expand All @@ -302,29 +384,20 @@ int ssb_main(int argc, char *argv[]) {

std::cout << "Started initializing with the required data ..." << std::endl;
read_from_csv();

if (DEBUG) {
workload = new SSB(0, true, agg_type);
workload->q11();
workload->q12();
workload->q13();
workload->q21_lip();
workload->q22_lip();
workload->q23_lip();
workload->q31_lip();
workload->q32_lip();
workload->q33_lip();
workload->q34_lip();
workload->q41_lip();
workload->q42_lip();
workload->q43_lip();
} else {
workload = new SSB(0, false, agg_type);
::benchmark::Initialize(&argc, argv);

std::cout << "Stated running benchmarks ..." << std::endl;
::benchmark::RunSpecifiedBenchmarks();
}
workload = new SSB(0, true, agg_type);
workload->q11();
workload->q12();
workload->q13();
workload->q21_lip();
workload->q22_lip();
workload->q23_lip();
workload->q31_lip();
workload->q32_lip();
workload->q33_lip();
workload->q34_lip();
workload->q41_lip();
workload->q42_lip();
workload->q43_lip();
return 0;
}

Expand Down Expand Up @@ -355,36 +428,44 @@ int aggregate_main(int argc, char *argv[]) {
}

int run_ssb_queries() {
SSBQueries ssb_queries;
ssb_queries.q11();
ssb_queries.q12();
ssb_queries.q13();
ssb_queries.q21();
ssb_queries.q22();
ssb_queries.q23();
ssb_queries.q31();
ssb_queries.q32();
ssb_queries.q33();
ssb_queries.q34();
ssb_queries.q41();
ssb_queries.q42();
ssb_queries.q43();
return 0;
ssb_queries = new SSBQueries(DEBUG);
if (DEBUG) {
ssb_queries->q11();
ssb_queries->q12();
ssb_queries->q13();
ssb_queries->q21();
ssb_queries->q22();
ssb_queries->q23();
ssb_queries->q31();
ssb_queries->q32();
ssb_queries->q33();
ssb_queries->q34();
ssb_queries->q41();
ssb_queries->q42();
ssb_queries->q43();
} else {
::benchmark::Initialize(NULL, NULL);

std::cout << "Stated running ssb query benchmarks ..." << std::endl;
::benchmark::RunSpecifiedBenchmarks();
}
delete ssb_queries;
return 0;
}

int main(int argc, char *argv[]) {
int benchmark_type = get_test(argc, argv);

if (benchmark_type == AGGREGATE_WORKLOAD) {
return aggregate_main(argc, argv);
return aggregate_main(argc, argv);
} else if (benchmark_type == SSB_WORKLOAD) {
return ssb_main(argc, argv);
return ssb_main(argc, argv);
} else if (benchmark_type == TATP_WORKLOAD) {
TATP tatp;
tatp.RunBenchmark();
return 0;
TATP tatp;
tatp.RunBenchmark();
return 0;
} else if (benchmark_type == SSB_QUERIES_WORKLOAD) {
return run_ssb_queries();
return run_ssb_queries();
}

std::cerr << "Abort: Wrong benchmark type: " << benchmark_type << std::endl;
Expand Down
Loading