forked from hyrise/hyrise
-
Notifications
You must be signed in to change notification settings - Fork 0
Script to run single tpch query once (what I used for profiling) in playground
Alexander Löser edited this page Jan 22, 2019
·
2 revisions
#include <iostream>
#include "tpch/tpch_table_generator.hpp"
#include "sql/sql_pipeline_builder.hpp"
#include "types.hpp"
#include "tpch/tpch_query_generator.hpp"
using namespace opossum; // NOLINT
int main(int argc, char** argv) {
if (argc != 2) {
std::cout << "usage: " << argv[0] << " <query-id>" << std::endl;
return 1;
}
const AllTypeVariant query_input = argv[1];
const float scale_factor = 1.f;
std::cout << "Starting to generate TCPH tables with scale factor " << scale_factor << "... " << std::endl;
opossum::TpchTableGenerator(scale_factor).generate_and_store();
const QueryID query_id {static_cast<QueryID>(type_cast_variant<int>(query_input)-1)};
std::cout << "Starting execution of TPCH query " << (query_id+1) << ":" << std::endl;
const auto sql = opossum::TPCHQueryGenerator(false, scale_factor).build_query(query_id);
std::cout << sql << std::endl;
auto builder = SQLPipelineBuilder{sql}.dont_cleanup_temporaries();
auto sql_pipeline = std::make_unique<SQLPipeline>(builder.create_pipeline());
auto result = sql_pipeline->get_result_table();
std::cout << "Successfully executed TPCH query " << (query_id+1) << std::endl;
return 0;
}