OmniSciDB  04ee39c94c
StorageTest.cpp File Reference
#include <csignal>
#include <cstring>
#include <iostream>
#include <string>
#include <cstdlib>
#include <exception>
#include <memory>
#include <thread>
#include <boost/functional/hash.hpp>
#include "../Analyzer/Analyzer.h"
#include "../Catalog/Catalog.h"
#include "../DataMgr/DataMgr.h"
#include "../Fragmenter/Fragmenter.h"
#include "../Parser/ParserNode.h"
#include "../Parser/parser.h"
#include "../QueryRunner/QueryRunner.h"
#include "PopulateTableRandom.h"
#include "ScanTable.h"
#include "Shared/MapDParameters.h"
#include "TestHelpers.h"
#include "boost/filesystem.hpp"
#include "boost/program_options.hpp"
#include "gtest/gtest.h"
+ Include dependency graph for StorageTest.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{StorageTest.cpp}
 

Macros

#define BASE_PATH   "./tmp"
 
#define SMALL   100000
 
#define LARGE   1000000
 

Typedefs

using QR = QueryRunner::QueryRunner
 

Functions

void anonymous_namespace{StorageTest.cpp}::run_ddl_statement (const string &input_str)
 
bool anonymous_namespace{StorageTest.cpp}::storage_test (const string &table_name, size_t num_rows)
 
void anonymous_namespace{StorageTest.cpp}::simple_thread_wrapper (const string &table_name, size_t num_rows, size_t thread_id)
 
bool anonymous_namespace{StorageTest.cpp}::storage_test_parallel (const string &table_name, size_t num_rows, size_t thread_count)
 
 TEST (StorageLarge, Numbers)
 
 TEST (StorageSmall, Strings)
 
 TEST (StorageSmall, AllTypes)
 
 TEST (StorageRename, AllTypes)
 
 TEST (StorageSmallParallel, AllTypes)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ BASE_PATH

#define BASE_PATH   "./tmp"

Definition at line 50 of file StorageTest.cpp.

Referenced by main().

◆ LARGE

#define LARGE   1000000

Definition at line 94 of file StorageTest.cpp.

Referenced by TEST().

◆ SMALL

#define SMALL   100000

Definition at line 93 of file StorageTest.cpp.

Referenced by TEST().

Typedef Documentation

◆ QR

Definition at line 53 of file StorageTest.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 176 of file StorageTest.cpp.

References BASE_PATH, logger::ERROR, QueryRunner::QueryRunner::init(), TestHelpers::init_logger_stderr_only(), LOG, and QueryRunner::QueryRunner::reset().

176  {
178  ::testing::InitGoogleTest(&argc, argv);
179 
181 
182  int err{0};
183  try {
184  err = RUN_ALL_TESTS();
185  } catch (const std::exception& e) {
186  LOG(ERROR) << e.what();
187  }
188  QR::reset();
189  return err;
190 }
#define LOG(tag)
Definition: Logger.h:182
static QueryRunner * init(const char *db_path, const std::string &udf_filename="", const size_t max_gpu_mem=0, const int reserved_gpu_mem=256<< 20)
Definition: QueryRunner.h:70
void init_logger_stderr_only(int argc, char const *const *argv)
Definition: TestHelpers.h:194
#define BASE_PATH
Definition: StorageTest.cpp:50
+ Here is the call graph for this function:

◆ TEST() [1/5]

TEST ( StorageLarge  ,
Numbers   
)

Definition at line 96 of file StorageTest.cpp.

References LARGE, run_ddl_statement(), and anonymous_namespace{StorageTest.cpp}::storage_test().

96  {
97  ASSERT_NO_THROW(run_ddl_statement("drop table if exists numbers;"););
98  ASSERT_NO_THROW(
100  "create table numbers (a smallint, b int, c bigint, d numeric(17,3), e "
101  "double, f float);"););
102  EXPECT_TRUE(storage_test("numbers", LARGE));
103  ASSERT_NO_THROW(run_ddl_statement("drop table numbers;"););
104 }
bool storage_test(const string &table_name, size_t num_rows)
Definition: StorageTest.cpp:60
#define LARGE
Definition: StorageTest.cpp:94
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:

◆ TEST() [2/5]

TEST ( StorageSmall  ,
Strings   
)

Definition at line 106 of file StorageTest.cpp.

References run_ddl_statement(), SMALL, and anonymous_namespace{StorageTest.cpp}::storage_test().

106  {
107  ASSERT_NO_THROW(run_ddl_statement("drop table if exists strings;"););
108  ASSERT_NO_THROW(
110  "create table strings (x varchar(10) encoding none, y text encoding none);"););
111  EXPECT_TRUE(storage_test("strings", SMALL));
112  ASSERT_NO_THROW(run_ddl_statement("drop table strings;"););
113 }
#define SMALL
Definition: StorageTest.cpp:93
bool storage_test(const string &table_name, size_t num_rows)
Definition: StorageTest.cpp:60
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:

◆ TEST() [3/5]

TEST ( StorageSmall  ,
AllTypes   
)

Definition at line 115 of file StorageTest.cpp.

References run_ddl_statement(), SMALL, and anonymous_namespace{StorageTest.cpp}::storage_test().

115  {
116  ASSERT_NO_THROW(run_ddl_statement("drop table if exists alltypes;"););
117  ASSERT_NO_THROW(
118  run_ddl_statement("create table alltypes (a smallint, b int, c bigint, d "
119  "numeric(17,3), e double, f float, "
120  "g timestamp(0), g_3 timestamp(3), g_6 timestamp(6), g_9 "
121  "timestamp(9), h time(0), i date, "
122  "x varchar(10) encoding none, y text encoding none);"););
123  EXPECT_TRUE(storage_test("alltypes", SMALL));
124  ASSERT_NO_THROW(run_ddl_statement("drop table alltypes;"););
125 }
#define SMALL
Definition: StorageTest.cpp:93
bool storage_test(const string &table_name, size_t num_rows)
Definition: StorageTest.cpp:60
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:

◆ TEST() [4/5]

TEST ( StorageRename  ,
AllTypes   
)

Definition at line 127 of file StorageTest.cpp.

References run_ddl_statement(), SMALL, and anonymous_namespace{StorageTest.cpp}::storage_test().

127  {
128  ASSERT_NO_THROW(run_ddl_statement("drop table if exists original_table;"););
129  ASSERT_NO_THROW(
130  run_ddl_statement("create table original_table (a smallint, b int, c bigint, d "
131  "numeric(17,3), e double, f float, "
132  "g timestamp(0), g_3 timestamp(3), g_6 timestamp(6), g_9 "
133  "timestamp(9), h time(0), i date, "
134  "x varchar(10) encoding none, y text encoding none);"););
135  EXPECT_TRUE(storage_test("original_table", SMALL));
136 
137  ASSERT_NO_THROW(run_ddl_statement("drop table if exists new_table;"););
138  ASSERT_NO_THROW(
139  run_ddl_statement("create table new_table (a smallint, b int, c bigint, d "
140  "numeric(17,3), e double, f float, "
141  "g timestamp(0), g_3 timestamp(3), g_6 timestamp(6), g_9 "
142  "timestamp(9), h time(0), i date, "
143  "x varchar(10) encoding none, y text encoding none);"););
144  EXPECT_TRUE(storage_test("new_table", SMALL));
145 
146  ASSERT_NO_THROW(run_ddl_statement("alter table original_table rename to old_table;"););
147 
148  ASSERT_NO_THROW(run_ddl_statement("alter table new_table rename to original_table;"););
149 
150  ASSERT_NO_THROW(run_ddl_statement("drop table old_table;"););
151 
152  ASSERT_NO_THROW(
153  run_ddl_statement("create table new_table (a smallint, b int, c bigint, d "
154  "numeric(17,3), e double, f float, "
155  "g timestamp(0), g_3 timestamp(3), g_6 timestamp(6), g_9 "
156  "timestamp(9), h time(0), i date, "
157  "x varchar(10) encoding none, y text encoding none);"););
158 
159  ASSERT_NO_THROW(run_ddl_statement("drop table original_table;"););
160  ASSERT_NO_THROW(run_ddl_statement("drop table new_table;"););
161 }
#define SMALL
Definition: StorageTest.cpp:93
bool storage_test(const string &table_name, size_t num_rows)
Definition: StorageTest.cpp:60
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:

◆ TEST() [5/5]

TEST ( StorageSmallParallel  ,
AllTypes   
)

Definition at line 163 of file StorageTest.cpp.

References run_ddl_statement(), SMALL, and anonymous_namespace{StorageTest.cpp}::storage_test_parallel().

163  {
164  ASSERT_NO_THROW(run_ddl_statement("drop table if exists alltypes;"););
165  ASSERT_NO_THROW(
167  "create table alltypes (a smallint, b int, c bigint, d numeric(17,3), e "
168  "double, f float, g timestamp(0), g_3 timestamp(3), g_6 timestamp(6), g_9 "
169  "timestamp(9), h time(0), i date, x varchar(10) encoding none, y text encoding "
170  "none);"););
171  EXPECT_TRUE(
172  storage_test_parallel("alltypes", SMALL, std::thread::hardware_concurrency()));
173  ASSERT_NO_THROW(run_ddl_statement("drop table alltypes;"););
174 }
#define SMALL
Definition: StorageTest.cpp:93
bool storage_test_parallel(const string &table_name, size_t num_rows, size_t thread_count)
Definition: StorageTest.cpp:74
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function: