OmniSciDB  5ade3759e0
anonymous_namespace{ExecuteTest.cpp} Namespace Reference

Classes

struct  ShardInfo
 
struct  SharedDictionaryInfo
 
class  SQLiteComparator
 

Functions

size_t choose_shard_count ()
 
std::string build_create_table_statement (const std::string &columns_definition, const std::string &table_name, const ShardInfo &shard_info, const std::vector< SharedDictionaryInfo > &shared_dict_info, const size_t fragment_size, const bool delete_support=true, const bool replicated=false)
 
std::shared_ptr< ResultSetrun_multiple_agg (const string &query_str, const ExecutorDeviceType device_type, const bool allow_loop_joins)
 
std::shared_ptr< ResultSetrun_multiple_agg (const string &query_str, const ExecutorDeviceType device_type)
 
TargetValue run_simple_agg (const string &query_str, const ExecutorDeviceType device_type, const bool geo_return_geo_tv=true, const bool allow_loop_joins=true)
 
TargetValue get_first_target (const string &query_str, const ExecutorDeviceType device_type, const bool geo_return_geo_tv=true)
 
void run_ddl_statement (const std::string &create_table_stmt)
 
bool skip_tests (const ExecutorDeviceType device_type)
 
bool approx_eq (const double v, const double target, const double eps=0.01)
 
int parse_fractional_seconds (uint sfrac, int ntotal, SQLTypeInfo &ti)
 
void c (const std::string &query_string, const ExecutorDeviceType device_type)
 
void c (const std::string &query_string, const std::string &sqlite_query_string, const ExecutorDeviceType device_type)
 
void cta (const std::string &query_string, const ExecutorDeviceType device_type)
 
void c_arrow (const std::string &query_string, const ExecutorDeviceType device_type)
 
void validate_storage_options (const std::pair< std::string, bool > type_meta, const std::pair< std::string, std::vector< std::string >> values)
 
void check_date_trunc_groups (const ResultSet &rows)
 
void check_one_date_trunc_group (const ResultSet &rows, const int64_t ref_ts)
 
void check_one_date_trunc_group_with_agg (const ResultSet &rows, const int64_t ref_ts, const int64_t ref_agg)
 
void import_array_test (const std::string &table_name)
 
void import_gpu_sort_test ()
 
void import_query_rewrite_test ()
 
void import_big_decimal_range_test ()
 
void import_decimal_compression_test ()
 
void import_subquery_test ()
 
void import_text_group_by_test ()
 
void import_join_test (bool with_delete_support)
 
void import_hash_join_test ()
 
void import_coalesce_cols_join_test (const int id, bool with_delete_support)
 
void import_emp_table ()
 
void import_dept_table ()
 
void import_geospatial_test ()
 
void import_geospatial_join_test (const bool replicate_inner_table=false)
 
void import_logical_size_test ()
 
void import_empty_table_test ()
 
void import_test_table_with_lots_of_columns ()
 
void validate_shard_agg (const ResultSet &rows, const std::vector< std::pair< int64_t, int64_t >> &expected)
 
void validate_timestamp_agg (const ResultSet &row, const int64_t expected_ts, const double expected_mean, const int64_t expected_count)
 
int create_sharded_join_table (const std::string &table_name, size_t fragment_size, size_t num_rows, const ShardInfo &shard_info, bool with_delete_support=true)
 
int create_and_populate_window_func_table ()
 
int create_and_populate_rounding_table ()
 
int create_and_populate_tables (bool with_delete_support=true)
 
int create_views ()
 
int create_as_select ()
 
int create_as_select_empty ()
 
void drop_tables ()
 
void drop_views ()
 

Variables

bool g_hoist_literals {true}
 
size_t g_shard_count {0}
 
bool g_use_row_iterator {true}
 
size_t g_num_leafs {1}
 
bool g_keep_test_data {false}
 
const ssize_t g_num_rows {10}
 
SQLiteComparator g_sqlite_comparator
 
const size_t g_array_test_row_count {20}
 

Function Documentation

◆ approx_eq()

bool anonymous_namespace{ExecuteTest.cpp}::approx_eq ( const double  v,
const double  target,
const double  eps = 0.01 
)

Definition at line 183 of file ExecuteTest.cpp.

Referenced by anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::compare_impl(), and TEST().

183  {
184  const auto v_u64 = *reinterpret_cast<const uint64_t*>(may_alias_ptr(&v));
185  const auto target_u64 = *reinterpret_cast<const uint64_t*>(may_alias_ptr(&target));
186  return v_u64 == target_u64 || (target - eps < v && v < target + eps);
187 }
T v(const TargetValue &r)
+ Here is the caller graph for this function:

◆ build_create_table_statement()

std::string anonymous_namespace{ExecuteTest.cpp}::build_create_table_statement ( const std::string &  columns_definition,
const std::string &  table_name,
const ShardInfo shard_info,
const std::vector< SharedDictionaryInfo > &  shared_dict_info,
const size_t  fragment_size,
const bool  delete_support = true,
const bool  replicated = false 
)

Definition at line 91 of file ExecuteTest.cpp.

References join(), anonymous_namespace{ExecuteTest.cpp}::ShardInfo::shard_col, and anonymous_namespace{ExecuteTest.cpp}::ShardInfo::shard_count.

Referenced by create_and_populate_tables(), create_sharded_join_table(), import_coalesce_cols_join_test(), import_geospatial_join_test(), import_join_test(), JoinTest::SetUp(), and TEST().

98  {
99  const std::string shard_key_def{
100  shard_info.shard_col.empty() ? "" : ", SHARD KEY (" + shard_info.shard_col + ")"};
101 
102  std::vector<std::string> shared_dict_def;
103  if (shared_dict_info.size() > 0) {
104  for (size_t idx = 0; idx < shared_dict_info.size(); ++idx) {
105  shared_dict_def.push_back(", SHARED DICTIONARY (" + shared_dict_info[idx].col +
106  ") REFERENCES " + shared_dict_info[idx].ref_table + "(" +
107  shared_dict_info[idx].ref_col + ")");
108  }
109  }
110 
111  std::ostringstream with_statement_assembly;
112  if (!shard_info.shard_col.empty()) {
113  with_statement_assembly << "shard_count=" << shard_info.shard_count << ", ";
114  }
115  with_statement_assembly << "fragment_size=" << fragment_size;
116 
117  if (delete_support) {
118  with_statement_assembly << ", vacuum='delayed'";
119  }
120 
121  // const std::string fragment_size_def{shard_info.shard_col.empty() ? "fragment_size=" +
122  // std::to_string(fragment_size)
123  // : ""};
124  // const std::string shard_count_def{shard_info.shard_col.empty() ? "" : "shard_count="
125  // +
126  // std::to_string(shard_info.shard_count)};
127  const std::string replicated_def{
128  (!replicated || !shard_info.shard_col.empty()) ? "" : ", PARTITIONS='REPLICATED' "};
129 
130  return "CREATE TABLE " + table_name + "(" + columns_definition + shard_key_def +
131  boost::algorithm::join(shared_dict_def, "") + ") WITH (" +
132  with_statement_assembly.str() + replicated_def + ");";
133 }
std::string join(T const &container, std::string const &delim)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ c() [1/2]

void anonymous_namespace{ExecuteTest.cpp}::c ( const std::string &  query_string,
const ExecutorDeviceType  device_type 
)

Definition at line 444 of file ExecuteTest.cpp.

References anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::compare().

Referenced by Parser::ArrayLiteral::analyze(), Parser::InsertStmt::analyze(), Parser::InsertValuesStmt::analyze(), Parser::QuerySpec::analyze_group_by(), Importer_NS::DataStreamSink::archivePlumber(), Analyzer::ColumnVar::check_group_by(), anonymous_namespace{UpdelStorageTest.cpp}::compare_row(), mapd::decode_base64(), mapd::decode_base64_uri(), Parser::InsertValuesStmt::determineLeafIndex(), Analyzer::Constant::do_cast(), Executor::executeSimpleInsert(), Parser::LikeExpr::get(), Parser::RegexpExpr::get(), Analyzer::CaseExpr::get_domain(), anonymous_namespace{UpdelStorageTest.cpp}::get_some_rows(), CgenState::getOrAddLiteral(), Importer_NS::Detector::importDelimited(), Parser::InsertIntoTableAsSelectStmt::InsertIntoTableAsSelectStmt(), Parser::InsertStmt::InsertStmt(), org.apache.calcite.sql2rel.SqlToRelConverter.Blackboard::lookupExp(), lowercase(), MapDExample.MapDExample::Main(), MapDExample::main(), main(), Planner::Optimizer::optimize_aggs(), Parser::InsertIntoTableAsSelectStmt::populateData(), SqliteConnector::query_with_text_params(), remove_unquoted_newlines_linefeeds_and_tabs_from_sql_string(), Catalog_Namespace::SessionInfo::set_catalog_ptr(), SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities >::set_compression(), TEST(), RelAlgTranslator::translateGeoLiteral(), and Fragmenter_Namespace::InsertOrderFragmenter::updateColumn().

444  {
445  g_sqlite_comparator.compare(query_string, device_type);
446 }
void compare(const std::string &query_string, const ExecutorDeviceType device_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ c() [2/2]

void anonymous_namespace{ExecuteTest.cpp}::c ( const std::string &  query_string,
const std::string &  sqlite_query_string,
const ExecutorDeviceType  device_type 
)

Definition at line 448 of file ExecuteTest.cpp.

References anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::compare().

Referenced by TEST().

450  {
451  g_sqlite_comparator.compare(query_string, sqlite_query_string, device_type);
452 }
void compare(const std::string &query_string, const ExecutorDeviceType device_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ c_arrow()

void anonymous_namespace{ExecuteTest.cpp}::c_arrow ( const std::string &  query_string,
const ExecutorDeviceType  device_type 
)

Definition at line 459 of file ExecuteTest.cpp.

References anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::compare_arrow_output().

Referenced by TEST().

459  {
460  g_sqlite_comparator.compare_arrow_output(query_string, query_string, device_type);
461 }
void compare_arrow_output(const std::string &query_string, const std::string &sqlite_query_string, const ExecutorDeviceType device_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_date_trunc_groups()

void anonymous_namespace{ExecuteTest.cpp}::check_date_trunc_groups ( const ResultSet rows)

Definition at line 2620 of file ExecuteTest.cpp.

References CHECK, CHECK_EQ, g_num_rows, and inline_int_null_val().

Referenced by TEST().

2620  {
2621  {
2622  const auto crt_row = rows.getNextRow(true, true);
2623  CHECK(!crt_row.empty());
2624  CHECK_EQ(size_t(3), crt_row.size());
2625  const auto sv0 = v<int64_t>(crt_row[0]);
2626  ASSERT_EQ(int64_t(936144000), sv0);
2627  const auto sv1 = boost::get<std::string>(v<NullableString>(crt_row[1]));
2628  ASSERT_EQ("foo", sv1);
2629  const auto sv2 = v<int64_t>(crt_row[2]);
2630  ASSERT_EQ(g_num_rows, sv2);
2631  }
2632  {
2633  const auto crt_row = rows.getNextRow(true, true);
2634  CHECK(!crt_row.empty());
2635  CHECK_EQ(size_t(3), crt_row.size());
2636  const auto sv0 = v<int64_t>(crt_row[0]);
2637  ASSERT_EQ(inline_int_null_val(rows.getColType(0)), sv0);
2638  const auto sv1 = boost::get<std::string>(v<NullableString>(crt_row[1]));
2639  ASSERT_EQ("bar", sv1);
2640  const auto sv2 = v<int64_t>(crt_row[2]);
2641  ASSERT_EQ(g_num_rows / 2, sv2);
2642  }
2643  {
2644  const auto crt_row = rows.getNextRow(true, true);
2645  CHECK(!crt_row.empty());
2646  CHECK_EQ(size_t(3), crt_row.size());
2647  const auto sv0 = v<int64_t>(crt_row[0]);
2648  ASSERT_EQ(int64_t(936144000), sv0);
2649  const auto sv1 = boost::get<std::string>(v<NullableString>(crt_row[1]));
2650  ASSERT_EQ("baz", sv1);
2651  const auto sv2 = v<int64_t>(crt_row[2]);
2652  ASSERT_EQ(g_num_rows / 2, sv2);
2653  }
2654  const auto crt_row = rows.getNextRow(true, true);
2655  CHECK(crt_row.empty());
2656 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
#define CHECK(condition)
Definition: Logger.h:187
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_one_date_trunc_group()

void anonymous_namespace{ExecuteTest.cpp}::check_one_date_trunc_group ( const ResultSet rows,
const int64_t  ref_ts 
)

Definition at line 2658 of file ExecuteTest.cpp.

Referenced by TEST().

2658  {
2659  const auto crt_row = rows.getNextRow(true, true);
2660  ASSERT_EQ(size_t(1), crt_row.size());
2661  const auto actual_ts = v<int64_t>(crt_row[0]);
2662  ASSERT_EQ(ref_ts, actual_ts);
2663  const auto empty_row = rows.getNextRow(true, true);
2664  ASSERT_TRUE(empty_row.empty());
2665 }
+ Here is the caller graph for this function:

◆ check_one_date_trunc_group_with_agg()

void anonymous_namespace{ExecuteTest.cpp}::check_one_date_trunc_group_with_agg ( const ResultSet rows,
const int64_t  ref_ts,
const int64_t  ref_agg 
)

Definition at line 2667 of file ExecuteTest.cpp.

Referenced by TEST().

2669  {
2670  const auto crt_row = rows.getNextRow(true, true);
2671  ASSERT_EQ(size_t(2), crt_row.size());
2672  const auto actual_ts = v<int64_t>(crt_row[0]);
2673  ASSERT_EQ(ref_ts, actual_ts);
2674  const auto actual_agg = v<int64_t>(crt_row[1]);
2675  ASSERT_EQ(ref_agg, actual_agg);
2676  const auto empty_row = rows.getNextRow(true, true);
2677  ASSERT_TRUE(empty_row.empty());
2678 }
+ Here is the caller graph for this function:

◆ choose_shard_count()

size_t anonymous_namespace{ExecuteTest.cpp}::choose_shard_count ( )

Definition at line 73 of file ExecuteTest.cpp.

References g_num_leafs, QueryRunner::QueryRunner::get(), QueryRunner::QueryRunner::getSession(), and session.

Referenced by create_and_populate_tables(), main(), and TEST().

73  {
74  auto session = QR::get()->getSession();
75  const auto cuda_mgr = session->getCatalog().getDataMgr().getCudaMgr();
76  const int device_count = cuda_mgr ? cuda_mgr->getDeviceCount() : 0;
77  return g_num_leafs * (device_count > 1 ? device_count : 1);
78 }
static QueryRunner * get()
Definition: QueryRunner.h:115
TSessionId session
Catalog_Namespace::SessionInfo * getSession() const
Definition: QueryRunner.h:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_and_populate_rounding_table()

int anonymous_namespace{ExecuteTest.cpp}::create_and_populate_rounding_table ( )

Definition at line 15512 of file ExecuteTest.cpp.

References CPU, logger::ERROR, g_sqlite_comparator, LOG, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

15512  {
15513  try {
15514  const std::string drop_test_table{"DROP TABLE IF EXISTS test_rounding;"};
15515  run_ddl_statement(drop_test_table);
15516  g_sqlite_comparator.query(drop_test_table);
15517 
15518  const std::string create_test_table{
15519  "CREATE TABLE test_rounding (s16 SMALLINT, s32 INTEGER, s64 BIGINT, f32 FLOAT, "
15520  "f64 DOUBLE, n64 NUMERIC(10,5), "
15521  "d64 DECIMAL(10,5));"};
15522  run_ddl_statement(create_test_table);
15523  g_sqlite_comparator.query(create_test_table);
15524 
15525  const std::string inser_positive_test_data{
15526  "INSERT INTO test_rounding VALUES(3456, 234567, 3456789012, 3456.3456, "
15527  "34567.23456, 34567.23456, "
15528  "34567.23456);"};
15529  run_multiple_agg(inser_positive_test_data, ExecutorDeviceType::CPU);
15530  g_sqlite_comparator.query(inser_positive_test_data);
15531 
15532  const std::string inser_negative_test_data{
15533  "INSERT INTO test_rounding VALUES(-3456, -234567, -3456789012, -3456.3456, "
15534  "-34567.23456, -34567.23456, "
15535  "-34567.23456);"};
15536  run_multiple_agg(inser_negative_test_data, ExecutorDeviceType::CPU);
15537  g_sqlite_comparator.query(inser_negative_test_data);
15538 
15539  const std::string inser_null_test_data{
15540  "INSERT INTO test_rounding VALUES(NULL, NULL, NULL, NULL, NULL, NULL, NULL);"};
15541  run_multiple_agg(inser_null_test_data, ExecutorDeviceType::CPU);
15542  g_sqlite_comparator.query(inser_null_test_data);
15543 
15544  } catch (...) {
15545  LOG(ERROR) << "Failed to (re-)create table 'test_rounding'";
15546  return -EEXIST;
15547  }
15548  return 0;
15549 }
#define LOG(tag)
Definition: Logger.h:182
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_and_populate_tables()

int anonymous_namespace{ExecuteTest.cpp}::create_and_populate_tables ( bool  with_delete_support = true)

Definition at line 15551 of file ExecuteTest.cpp.

References build_create_table_statement(), CHECK, CHECK_EQ, choose_shard_count(), CPU, create_and_populate_rounding_table(), create_and_populate_window_func_table(), create_sharded_join_table(), logger::ERROR, g_aggregator, g_num_rows, g_shard_count, g_sqlite_comparator, QueryRunner::QueryRunner::get(), Catalog_Namespace::SessionInfo::getCatalog(), Catalog_Namespace::Catalog::getMetadataForTable(), QueryRunner::QueryRunner::getSession(), import_array_test(), import_big_decimal_range_test(), import_coalesce_cols_join_test(), import_decimal_compression_test(), import_dept_table(), import_emp_table(), import_empty_table_test(), import_geospatial_join_test(), import_geospatial_test(), import_gpu_sort_test(), import_hash_join_test(), import_join_test(), import_logical_size_test(), import_query_rewrite_test(), import_subquery_test(), import_test_table_with_lots_of_columns(), import_text_group_by_test(), LOG, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by main().

15551  {
15552  try {
15553  const std::string drop_old_test{"DROP TABLE IF EXISTS test_inner;"};
15554  run_ddl_statement(drop_old_test);
15555  g_sqlite_comparator.query(drop_old_test);
15556  std::string columns_definition{
15557  "x int not null, y int, xx smallint, str text encoding dict, dt DATE, dt32 DATE "
15558  "ENCODING FIXED(32), dt16 DATE ENCODING FIXED(16), ts TIMESTAMP"};
15559  const auto create_test_inner =
15560  build_create_table_statement(columns_definition,
15561  "test_inner",
15562  {g_shard_count ? "str" : "", g_shard_count},
15563  {},
15564  2,
15565  with_delete_support,
15566  g_aggregator);
15567  run_ddl_statement(create_test_inner);
15569  "CREATE TABLE test_inner(x int not null, y int, xx smallint, str text, dt DATE, "
15570  "dt32 DATE, dt16 DATE, ts DATETIME);");
15571  } catch (...) {
15572  LOG(ERROR) << "Failed to (re-)create table 'test_inner'";
15573  return -EEXIST;
15574  }
15575  {
15576  const std::string insert_query{
15577  "INSERT INTO test_inner VALUES(7, 43, 7, 'foo', '1999-09-09', '1999-09-09', "
15578  "'1999-09-09', '2014-12-13 22:23:15');"};
15580  g_sqlite_comparator.query(insert_query);
15581  }
15582  {
15583  const std::string insert_query{
15584  "INSERT INTO test_inner VALUES(-9, 72, -9, 'bars', '2014-12-13', '2014-12-13', "
15585  "'2014-12-13', '1999-09-09 14:15:16');"};
15587  g_sqlite_comparator.query(insert_query);
15588  }
15589  try {
15590  using namespace std::string_literals;
15591  auto drop_old_bweq_test = "DROP TABLE IF EXISTS bweq_test"s;
15592  run_ddl_statement(drop_old_bweq_test);
15593  g_sqlite_comparator.query(drop_old_bweq_test);
15594 
15595  auto column_definition = "x int"s;
15596  auto create_bweq_test =
15597  build_create_table_statement(column_definition,
15598  "bweq_test",
15599  {g_shard_count ? "x" : "", g_shard_count},
15600  {},
15601  2,
15602  with_delete_support,
15603  g_aggregator);
15604  run_ddl_statement(create_bweq_test);
15605  g_sqlite_comparator.query("create table bweq_test (x int);");
15606  } catch (...) {
15607  LOG(ERROR) << "Failed to (re-)create table 'bweq_test'";
15608  return -EEXIST;
15609  }
15610  {
15611  auto insert_non_null_query = "insert into bweq_test values(7);"s;
15612  auto insert_null_query = "insert into bweq_test values(NULL);"s;
15613 
15614  auto non_null_insertion = [&] {
15615  run_multiple_agg(insert_non_null_query, ExecutorDeviceType::CPU);
15616  g_sqlite_comparator.query(insert_non_null_query);
15617  };
15618  auto null_insertion = [&] {
15619  run_multiple_agg(insert_null_query, ExecutorDeviceType::CPU);
15620  g_sqlite_comparator.query(insert_null_query);
15621  };
15622 
15623  for (auto i = 0; i < 15; i++) {
15624  non_null_insertion();
15625  }
15626  for (auto i = 0; i < 5; i++) {
15627  null_insertion();
15628  }
15629  }
15630  try {
15631  const std::string drop_old_test{"DROP TABLE IF EXISTS vacuum_test_alt;"};
15632  run_ddl_statement(drop_old_test);
15633  g_sqlite_comparator.query(drop_old_test);
15634  std::string columns_definition{"x int not null, y int"};
15635  const auto create_vacuum_test_alt =
15636  build_create_table_statement(columns_definition,
15637  "vacuum_test_alt",
15638  {g_shard_count ? "x" : "", g_shard_count},
15639  {},
15640  2,
15641  with_delete_support,
15642  g_aggregator);
15643  run_ddl_statement(create_vacuum_test_alt);
15644  g_sqlite_comparator.query("CREATE TABLE vacuum_test_alt(x int not null, y int );");
15645 
15646  } catch (...) {
15647  LOG(ERROR) << "Failed to (re-)create table 'vacuum_test_alt'";
15648  return -EEXIST;
15649  }
15650  {
15651  const std::string insert_query1{"INSERT INTO vacuum_test_alt VALUES(1,10);"};
15652  const std::string insert_query2{"INSERT INTO vacuum_test_alt VALUES(2,20);"};
15653  const std::string insert_query3{"INSERT INTO vacuum_test_alt VALUES(3,30);"};
15654  const std::string insert_query4{"INSERT INTO vacuum_test_alt VALUES(4,40);"};
15655 
15656  run_multiple_agg(insert_query1, ExecutorDeviceType::CPU);
15657  g_sqlite_comparator.query(insert_query1);
15658  run_multiple_agg(insert_query2, ExecutorDeviceType::CPU);
15659  g_sqlite_comparator.query(insert_query2);
15660  run_multiple_agg(insert_query3, ExecutorDeviceType::CPU);
15661  g_sqlite_comparator.query(insert_query3);
15662  run_multiple_agg(insert_query4, ExecutorDeviceType::CPU);
15663  g_sqlite_comparator.query(insert_query4);
15664  }
15665  try {
15666 #if 0
15667  const std::string drop_old_test_inner_deleted{"DROP TABLE IF EXISTS test_inner_deleted;"};
15668  run_ddl_statement(drop_old_test_inner_deleted);
15669  g_sqlite_comparator.query(drop_old_test_inner_deleted);
15670  std::string columns_definition{"x int not null, y int, str text encoding dict, deleted boolean"};
15671 
15672  const auto create_test_inner_deleted =
15673  build_create_table_statement(columns_definition, "test_inner_deleted", {"", 0}, {}, 2, with_delete_support );
15674  run_ddl_statement(create_test_inner_deleted);
15675  auto& cat = QR::get()->getSession()->getCatalog();
15676  const auto td = cat.getMetadataForTable("test_inner_deleted");
15677  CHECK(td);
15678  const auto cd = cat.getMetadataForColumn(td->tableId, "deleted");
15679  CHECK(cd);
15680  cat.setDeletedColumn(td, cd);
15681 
15682  g_sqlite_comparator.query("CREATE TABLE test_inner_deleted(x int not null, y int, str text);");
15683 #endif
15684  } catch (...) {
15685  LOG(ERROR) << "Failed to (re-)create table 'test_inner_deleted'";
15686  return -EEXIST;
15687  }
15688  {
15689 #if 0
15690  const std::string insert_query{"INSERT INTO test_inner_deleted VALUES(7, 43, 'foo', 't');"};
15692 #endif
15693  }
15694  try {
15695  const std::string drop_old_test{"DROP TABLE IF EXISTS test_inner_x;"};
15696  run_ddl_statement(drop_old_test);
15697  g_sqlite_comparator.query(drop_old_test);
15698  std::string columns_definition{"x int not null, y int, str text encoding dict"};
15699  const auto create_test_inner =
15700  build_create_table_statement(columns_definition,
15701  "test_inner_x",
15702  {g_shard_count ? "x" : "", g_shard_count},
15703  {},
15704  2,
15705  with_delete_support,
15706  g_aggregator);
15707  run_ddl_statement(create_test_inner);
15709  "CREATE TABLE test_inner_x(x int not null, y int, str text);");
15710  } catch (...) {
15711  LOG(ERROR) << "Failed to (re-)create table 'test_inner_x'";
15712  return -EEXIST;
15713  }
15714  {
15715  const std::string insert_query{"INSERT INTO test_inner_x VALUES(7, 43, 'foo');"};
15717  g_sqlite_comparator.query(insert_query);
15718  }
15719  try {
15720  const std::string drop_old_test{"DROP TABLE IF EXISTS test_inner_y;"};
15721  run_ddl_statement(drop_old_test);
15722  g_sqlite_comparator.query(drop_old_test);
15723  std::string columns_definition{"x int not null, y int, str text encoding dict"};
15724  const auto create_test_inner =
15725  build_create_table_statement(columns_definition,
15726  "test_inner_y",
15727  {g_shard_count ? "x" : "", g_shard_count},
15728  {},
15729  2,
15730  with_delete_support,
15731  g_aggregator);
15732  run_ddl_statement(create_test_inner);
15734  "CREATE TABLE test_inner_y(x int not null, y int, str text);");
15735  } catch (...) {
15736  LOG(ERROR) << "Failed to (re-)create table 'test_inner_y'";
15737  return -EEXIST;
15738  }
15739  {
15740  const std::string insert_query{"INSERT INTO test_inner_y VALUES(8, 43, 'bar');"};
15742  g_sqlite_comparator.query(insert_query);
15743  }
15744  {
15745  const std::string insert_query{"INSERT INTO test_inner_y VALUES(7, 43, 'foo');"};
15747  g_sqlite_comparator.query(insert_query);
15748  }
15749  try {
15750  const std::string drop_old_bar{"DROP TABLE IF EXISTS bar;"};
15751  run_ddl_statement(drop_old_bar);
15752  g_sqlite_comparator.query(drop_old_bar);
15753  std::string columns_definition{"str text encoding dict"};
15754  const auto create_bar = build_create_table_statement(
15755  columns_definition, "bar", {"", 0}, {}, 2, with_delete_support, g_aggregator);
15756  run_ddl_statement(create_bar);
15757  g_sqlite_comparator.query("CREATE TABLE bar(str text);");
15758  } catch (...) {
15759  LOG(ERROR) << "Failed to (re-)create table 'bar'";
15760  return -EEXIST;
15761  }
15762  {
15763  const std::string insert_query{"INSERT INTO bar VALUES('bar');"};
15765  g_sqlite_comparator.query(insert_query);
15766  }
15767  try {
15768  const std::string drop_proj_top{"DROP TABLE IF EXISTS proj_top;"};
15769  run_ddl_statement(drop_proj_top);
15770  g_sqlite_comparator.query(drop_proj_top);
15771  const auto create_proj_top = "CREATE TABLE proj_top(str TEXT ENCODING NONE, x INT);";
15772  const auto create_proj_top_sqlite = "CREATE TABLE proj_top(str TEXT, x INT);";
15773  run_ddl_statement(create_proj_top);
15774  g_sqlite_comparator.query(create_proj_top_sqlite);
15775  {
15776  const auto insert_query = "INSERT INTO proj_top VALUES('a', 7);";
15778  g_sqlite_comparator.query(insert_query);
15779  }
15780  {
15781  const auto insert_query = "INSERT INTO proj_top VALUES('b', 6);";
15783  g_sqlite_comparator.query(insert_query);
15784  }
15785  {
15786  const auto insert_query = "INSERT INTO proj_top VALUES('c', 5);";
15788  g_sqlite_comparator.query(insert_query);
15789  }
15790  } catch (...) {
15791  LOG(ERROR) << "Failed to (re-)create table 'proj_top'";
15792  return -EEXIST;
15793  }
15794  try {
15795  const std::string drop_old_test{"DROP TABLE IF EXISTS test;"};
15796  run_ddl_statement(drop_old_test);
15797  g_sqlite_comparator.query(drop_old_test);
15798  std::string columns_definition{
15799  "x int not null, y int, z smallint, t bigint, b boolean, f float, ff float, fn "
15800  "float, d double, dn double, str "
15801  "varchar(10), null_str text encoding dict, fixed_str text encoding dict(16), "
15802  "fixed_null_str text encoding "
15803  "dict(16), real_str text encoding none, shared_dict text, m timestamp(0), m_3 "
15804  "timestamp(3), m_6 timestamp(6), "
15805  "m_9 timestamp(9), n time(0), o date, o1 date encoding fixed(16), o2 date "
15806  "encoding fixed(32), fx int "
15807  "encoding fixed(16), dd decimal(10, 2), dd_notnull decimal(10, 2) not null, ss "
15808  "text encoding dict, u int, ofd "
15809  "int, ufd int not null, ofq bigint, ufq bigint not null, smallint_nulls "
15810  "smallint"};
15811  const std::string create_test = build_create_table_statement(
15812  columns_definition,
15813  "test",
15814  {g_shard_count ? "str" : "", g_shard_count},
15815  {{"str", "test_inner", "str"}, {"shared_dict", "test", "str"}},
15816  2,
15817  with_delete_support);
15818  run_ddl_statement(create_test);
15820  "CREATE TABLE test(x int not null, y int, z smallint, t bigint, b boolean, f "
15821  "float, ff float, fn float, d "
15822  "double, dn double, str varchar(10), null_str text, fixed_str text, "
15823  "fixed_null_str text, real_str text, "
15824  "shared_dict "
15825  "text, m timestamp(0), m_3 timestamp(3), m_6 timestamp(6), m_9 timestamp(9), n "
15826  "time(0), o date, o1 date, o2 date, "
15827  "fx int, dd decimal(10, 2), dd_notnull decimal(10, 2) not "
15828  "null, ss "
15829  "text, u int, ofd int, ufd int not null, ofq bigint, ufq bigint not null, "
15830  "smallint_nulls smallint);");
15831  } catch (...) {
15832  LOG(ERROR) << "Failed to (re-)create table 'test'";
15833  return -EEXIST;
15834  }
15835  CHECK_EQ(g_num_rows % 2, 0);
15836  for (ssize_t i = 0; i < g_num_rows; ++i) {
15837  const std::string insert_query{
15838  "INSERT INTO test VALUES(7, 42, 101, 1001, 't', 1.1, 1.1, null, 2.2, null, "
15839  "'foo', null, 'foo', null, "
15840  "'real_foo', 'foo',"
15841  "'2014-12-13 22:23:15', '2014-12-13 22:23:15.323', '1999-07-11 14:02:53.874533', "
15842  "'2006-04-26 "
15843  "03:49:04.607435125', "
15844  "'15:13:14', '1999-09-09', '1999-09-09', '1999-09-09', 9, 111.1, 111.1, 'fish', "
15845  "null, "
15846  "2147483647, -2147483648, null, -1, 32767);"};
15848  g_sqlite_comparator.query(insert_query);
15849  }
15850  for (ssize_t i = 0; i < g_num_rows / 2; ++i) {
15851  const std::string insert_query{
15852  "INSERT INTO test VALUES(8, 43, -78, 1002, 'f', 1.2, 101.2, -101.2, 2.4, "
15853  "-2002.4, 'bar', null, 'bar', null, "
15854  "'real_bar', NULL, '2014-12-13 22:23:15', '2014-12-13 22:23:15.323', '2014-12-13 "
15855  "22:23:15.874533', "
15856  "'2014-12-13 22:23:15.607435763', '15:13:14', NULL, NULL, NULL, NULL, 222.2, "
15857  "222.2, "
15858  "null, null, null, "
15859  "-2147483647, "
15860  "9223372036854775807, -9223372036854775808, null);"};
15862  g_sqlite_comparator.query(insert_query);
15863  }
15864  for (ssize_t i = 0; i < g_num_rows / 2; ++i) {
15865  const std::string insert_query{
15866  "INSERT INTO test VALUES(7, 43, 102, 1002, 't', 1.3, 1000.3, -1000.3, 2.6, "
15867  "-220.6, 'baz', null, null, null, "
15868  "'real_baz', 'baz', '2014-12-14 22:23:15', '2014-12-14 22:23:15.750', "
15869  "'2014-12-14 22:23:15.437321', "
15870  "'2014-12-14 22:23:15.934567401', '15:13:14', '1999-09-09', '1999-09-09', "
15871  "'1999-09-09', 11, "
15872  "333.3, 333.3, "
15873  "'boat', null, 1, "
15874  "-1, 1, -9223372036854775808, 1);"};
15876  g_sqlite_comparator.query(insert_query);
15877  }
15878  try {
15879  const std::string drop_old_test{"DROP TABLE IF EXISTS test_empty;"};
15880  run_ddl_statement(drop_old_test);
15881  g_sqlite_comparator.query(drop_old_test);
15882  std::string columns_definition{
15883  "x int not null, y int, z smallint, t bigint, b boolean, f float, ff float, fn "
15884  "float, d double, dn double, str "
15885  "varchar(10), null_str text encoding dict, fixed_str text encoding dict(16), "
15886  "fixed_null_str text encoding "
15887  "dict(16), real_str text encoding none, shared_dict text, m timestamp(0), "
15888  "n time(0), o date, o1 date encoding fixed(16), o2 date "
15889  "encoding fixed(32), fx int "
15890  "encoding fixed(16), dd decimal(10, 2), dd_notnull decimal(10, 2) not null, ss "
15891  "text encoding dict, u int, ofd "
15892  "int, ufd int not null, ofq bigint, ufq bigint not null"};
15893  const std::string create_test = build_create_table_statement(
15894  columns_definition,
15895  "test_empty",
15896  {g_shard_count ? "str" : "", g_shard_count},
15897  {{"str", "test_inner", "str"}, {"shared_dict", "test", "str"}},
15898  2,
15899  with_delete_support,
15900  g_aggregator);
15901  run_ddl_statement(create_test);
15903  "CREATE TABLE test_empty(x int not null, y int, z smallint, t bigint, b boolean, "
15904  "f "
15905  "float, ff float, fn float, d "
15906  "double, dn double, str varchar(10), null_str text, fixed_str text, "
15907  "fixed_null_str text, real_str text, "
15908  "shared_dict "
15909  "text, m timestamp(0), n "
15910  "time(0), o date, o1 date, o2 date, "
15911  "fx int, dd decimal(10, 2), dd_notnull decimal(10, 2) not "
15912  "null, ss "
15913  "text, u int, ofd int, ufd int not null, ofq bigint, ufq bigint not null);");
15914  } catch (...) {
15915  LOG(ERROR) << "Failed to (re-)create table 'test_empty'";
15916  return -EEXIST;
15917  }
15918  try {
15919  const std::string drop_old_test{"DROP TABLE IF EXISTS test_one_row;"};
15920  run_ddl_statement(drop_old_test);
15921  g_sqlite_comparator.query(drop_old_test);
15922  std::string columns_definition{
15923  "x int not null, y int, z smallint, t bigint, b boolean, f float, ff float, fn "
15924  "float, d double, dn double, str "
15925  "varchar(10), null_str text encoding dict, fixed_str text encoding dict(16), "
15926  "fixed_null_str text encoding "
15927  "dict(16), real_str text encoding none, shared_dict text, m timestamp(0), "
15928  "n time(0), o date, o1 date encoding fixed(16), o2 date "
15929  "encoding fixed(32), fx int "
15930  "encoding fixed(16), dd decimal(10, 2), dd_notnull decimal(10, 2) not null, ss "
15931  "text encoding dict, u int, ofd "
15932  "int, ufd int not null, ofq bigint, ufq bigint not null"};
15933  const std::string create_test = build_create_table_statement(
15934  columns_definition,
15935  "test_one_row",
15936  {g_shard_count ? "str" : "", g_shard_count},
15937  {{"str", "test_inner", "str"}, {"shared_dict", "test", "str"}},
15938  2,
15939  with_delete_support,
15940  g_aggregator);
15941  run_ddl_statement(create_test);
15943  "CREATE TABLE test_one_row(x int not null, y int, z smallint, t bigint, b "
15944  "boolean, "
15945  "f "
15946  "float, ff float, fn float, d "
15947  "double, dn double, str varchar(10), null_str text, fixed_str text, "
15948  "fixed_null_str text, real_str text, "
15949  "shared_dict "
15950  "text, m timestamp(0), n "
15951  "time(0), o date, o1 date, o2 date, "
15952  "fx int, dd decimal(10, 2), dd_notnull decimal(10, 2) not "
15953  "null, ss "
15954  "text, u int, ofd int, ufd int not null, ofq bigint, ufq bigint not null);");
15955  } catch (...) {
15956  LOG(ERROR) << "Failed to (re-)create table 'test_one_row'";
15957  return -EEXIST;
15958  }
15959  {
15960  const std::string insert_query{
15961  "INSERT INTO test_one_row VALUES(8, 43, -78, 1002, 'f', 1.2, 101.2, -101.2, 2.4, "
15962  "-2002.4, 'bar', null, 'bar', null, "
15963  "'real_bar', NULL, '2014-12-13 22:23:15', "
15964  "'15:13:14', NULL, NULL, NULL, NULL, 222.2, 222.2, "
15965  "null, null, null, "
15966  "-2147483647, "
15967  "9223372036854775807, -9223372036854775808);"};
15969  g_sqlite_comparator.query(insert_query);
15970  }
15971  try {
15972  const std::string drop_old_test{"DROP TABLE IF EXISTS test_ranges;"};
15973  run_ddl_statement(drop_old_test);
15974  g_sqlite_comparator.query(drop_old_test);
15975  std::string columns_definition{"i INT, b BIGINT"};
15976  const std::string create_test = build_create_table_statement(
15977  columns_definition, "test_ranges", {"", 0}, {}, 2, with_delete_support);
15978  run_ddl_statement(create_test);
15979  g_sqlite_comparator.query("CREATE TABLE test_ranges(i INT, b BIGINT);");
15980  } catch (...) {
15981  LOG(ERROR) << "Failed to (re-)create table 'test_ranges'";
15982  return -EEXIST;
15983  }
15984  {
15985  const std::string insert_query{
15986  "INSERT INTO test_ranges VALUES(2147483647, 9223372036854775806);"};
15988  g_sqlite_comparator.query(insert_query);
15989  }
15990  {
15991  const std::string insert_query{
15992  "INSERT INTO test_ranges VALUES(-2147483647, -9223372036854775807);"};
15994  g_sqlite_comparator.query(insert_query);
15995  }
15996  try {
15997  const std::string drop_old_test{"DROP TABLE IF EXISTS test_x;"};
15998  run_ddl_statement(drop_old_test);
15999  g_sqlite_comparator.query(drop_old_test);
16000  std::string columns_definition{
16001  "x int not null, y int, z smallint, t bigint, b boolean, f float, ff float, fn "
16002  "float, d double, dn double, str "
16003  "text, null_str text encoding dict, fixed_str text encoding dict(16), real_str "
16004  "text encoding none, m "
16005  "timestamp(0), n time(0), o date, o1 date encoding fixed(16), "
16006  "o2 date encoding fixed(32), fx int encoding fixed(16), dd decimal(10, 2), "
16007  "dd_notnull decimal(10, 2) not null, ss text encoding dict, u int, ofd int, ufd "
16008  "int not null, ofq bigint, ufq "
16009  "bigint not null"};
16010  const std::string create_test =
16011  build_create_table_statement(columns_definition,
16012  "test_x",
16013  {g_shard_count ? "x" : "", g_shard_count},
16014  {},
16015  2,
16016  with_delete_support);
16017  run_ddl_statement(create_test);
16019  "CREATE TABLE test_x(x int not null, y int, z smallint, t bigint, b boolean, f "
16020  "float, ff float, fn float, d "
16021  "double, dn double, str "
16022  "text, null_str text,"
16023  "fixed_str text, real_str text, m timestamp(0), n time(0), o date, o1 date, "
16024  "o2 date, fx int, dd decimal(10, 2), "
16025  "dd_notnull decimal(10, 2) not null, ss text, u int, ofd int, ufd int not null, "
16026  "ofq bigint, ufq bigint not "
16027  "null);");
16028  } catch (...) {
16029  LOG(ERROR) << "Failed to (re-)create table 'test_x'";
16030  return -EEXIST;
16031  }
16032  CHECK_EQ(g_num_rows % 2, 0);
16033  for (ssize_t i = 0; i < g_num_rows; ++i) {
16034  const std::string insert_query{
16035  "INSERT INTO test_x VALUES(7, 42, 101, 1001, 't', 1.1, 1.1, null, 2.2, null, "
16036  "'foo', null, 'foo', 'real_foo', "
16037  "'2014-12-13 "
16038  "22:23:15', "
16039  "'15:13:14', '1999-09-09', '1999-09-09', '1999-09-09', 9, 111.1, 111.1, 'fish', "
16040  "null, "
16041  "2147483647, -2147483648, null, -1);"};
16043  g_sqlite_comparator.query(insert_query);
16044  }
16045  for (ssize_t i = 0; i < g_num_rows / 2; ++i) {
16046  const std::string insert_query{
16047  "INSERT INTO test_x VALUES(8, 43, 102, 1002, 'f', 1.2, 101.2, -101.2, 2.4, "
16048  "-2002.4, 'bar', null, 'bar', "
16049  "'real_bar', "
16050  "'2014-12-13 "
16051  "22:23:15', "
16052  "'15:13:14', NULL, NULL, NULL, NULL, 222.2, 222.2, null, null, null, "
16053  "-2147483647, "
16054  "9223372036854775807, "
16055  "-9223372036854775808);"};
16057  g_sqlite_comparator.query(insert_query);
16058  }
16059  for (ssize_t i = 0; i < g_num_rows / 2; ++i) {
16060  const std::string insert_query{
16061  "INSERT INTO test_x VALUES(7, 43, 102, 1002, 't', 1.3, 1000.3, -1000.3, 2.6, "
16062  "-220.6, 'baz', null, 'baz', "
16063  "'real_baz', "
16064  "'2014-12-13 "
16065  "22:23:15', "
16066  "'15:13:14', '1999-09-09', '1999-09-09', '1999-09-09', 11, 333.3, 333.3, 'boat', "
16067  "null, 1, -1, "
16068  "1, -9223372036854775808);"};
16070  g_sqlite_comparator.query(insert_query);
16071  }
16072  try {
16073  const std::string drop_old_array_test{"DROP TABLE IF EXISTS array_test;"};
16074  run_ddl_statement(drop_old_array_test);
16075  std::string columns_definition{
16076  "x int not null, arr_i16 smallint[], arr_i32 int[], arr_i64 bigint[], arr_str "
16077  "text[] encoding dict, arr_float float[], arr_double double[], arr_bool "
16078  "boolean[], real_str text encoding none, arr3_i8 tinyint[3], arr3_i16 "
16079  "smallint[3], arr3_i32 int[3], arr3_i64 bigint[3], arr3_float float[3], "
16080  "arr3_double double[3], arr6_bool boolean[6]"};
16081  const std::string create_array_test =
16082  build_create_table_statement(columns_definition,
16083  "array_test",
16084  {"", 0},
16085  {},
16086  32000000,
16087  with_delete_support,
16088  g_aggregator);
16089  run_ddl_statement(create_array_test);
16090  } catch (...) {
16091  LOG(ERROR) << "Failed to (re-)create table 'array_test'";
16092  return -EEXIST;
16093  }
16094  import_array_test("array_test");
16095  try {
16096  const std::string drop_old_array_test{"DROP TABLE IF EXISTS array_test_inner;"};
16097  run_ddl_statement(drop_old_array_test);
16098  const std::string create_array_test{
16099  "CREATE TABLE array_test_inner(x int, arr_i16 smallint[], arr_i32 int[], arr_i64 "
16100  "bigint[], arr_str text[] "
16101  "encoding "
16102  "dict, "
16103  "arr_float float[], arr_double double[], arr_bool boolean[], real_str text "
16104  "encoding none) WITH "
16105  "(fragment_size=4000000, partitions='REPLICATED');"};
16106  run_ddl_statement(create_array_test);
16107  } catch (...) {
16108  LOG(ERROR) << "Failed to (re-)create table 'array_test_inner'";
16109  return -EEXIST;
16110  }
16111  import_array_test("array_test_inner");
16112  if (!g_aggregator) {
16113  try {
16114  size_t num_shards = choose_shard_count();
16115  // check if the oversubscriptions to GPU for multiple Shard is correctly functional
16116  // or not.
16117  const size_t num_oversubscription = 10;
16118 
16119  ShardInfo shard_info{(num_shards) ? "i" : "", num_shards};
16120  size_t fragment_size = 2;
16121  bool delete_support = false;
16122 
16124  fragment_size,
16125  num_oversubscription * num_shards,
16126  shard_info,
16127  delete_support);
16129  "st2", fragment_size, num_shards * fragment_size, shard_info, delete_support);
16131  "st3", fragment_size, 8 * num_shards, shard_info, delete_support);
16132 
16133  } catch (...) {
16134  LOG(ERROR) << "Failed to (re-)create table 'array_test_inner'";
16135  return -EEXIST;
16136  }
16137  }
16138  try {
16139  const std::string drop_old_unnest_join_test{"DROP TABLE IF EXISTS unnest_join_test;"};
16140  run_ddl_statement(drop_old_unnest_join_test);
16141  const std::string create_unnest_join_test{
16142  "CREATE TABLE unnest_join_test(x TEXT ENCODING DICT(32));"};
16143  run_ddl_statement(create_unnest_join_test);
16144  } catch (...) {
16145  LOG(ERROR) << "Failed to (re-)create table 'unnest_join_test'";
16146  return -EEXIST;
16147  }
16148  {
16149  std::array<std::string, 5> strings{"aaa", "bbb", "ccc", "ddd", "NULL"};
16150  for (size_t i = 0; i < 10; i++) {
16151  const std::string insert_query{"INSERT INTO unnest_join_test VALUES('" +
16152  strings[i % strings.size()] + "');"};
16154  }
16155  }
16156  try {
16157  const std::string drop_old_single_row_test{"DROP TABLE IF EXISTS single_row_test;"};
16158  run_ddl_statement(drop_old_single_row_test);
16159  g_sqlite_comparator.query(drop_old_single_row_test);
16160 
16161  if (g_aggregator) {
16163  "CREATE TABLE single_row_test(x int) WITH (PARTITIONS='REPLICATED');");
16164  } else {
16165  run_ddl_statement("CREATE TABLE single_row_test(x int);");
16166  }
16167 
16168  g_sqlite_comparator.query("CREATE TABLE single_row_test(x int);");
16169  } catch (...) {
16170  LOG(ERROR) << "Failed to (re-)create table 'single_row_test'";
16171  return -EEXIST;
16172  }
16173  {
16174  const std::string insert_query{"INSERT INTO single_row_test VALUES(null);"};
16176  g_sqlite_comparator.query(insert_query);
16177  }
16178  try {
16180  } catch (...) {
16181  LOG(ERROR) << "Failed to (re-)create table 'gpu_sort_test'";
16182  return -EEXIST;
16183  }
16184  try {
16186  } catch (...) {
16187  LOG(ERROR) << "Failed to (re-)create table 'query_rewrite_test'";
16188  return -EEXIST;
16189  }
16190  try {
16192  } catch (...) {
16193  LOG(ERROR) << "Failed to (re-)create table 'big_decimal_range_test'";
16194  return -EEXIST;
16195  }
16196  try {
16198  } catch (...) {
16199  LOG(ERROR) << "Failed to (re-)create table 'decimal_compression_test";
16200  return -EEXIST;
16201  }
16202  try {
16204  } catch (...) {
16205  LOG(ERROR) << "Failed to (re-)create table 'subquery_test'";
16206  return -EEXIST;
16207  }
16208  try {
16210  } catch (...) {
16211  LOG(ERROR) << "Failed to (re-)create table 'text_group_by_test'";
16212  return -EEXIST;
16213  }
16214  try {
16215  import_join_test(with_delete_support);
16216  } catch (...) {
16217  LOG(ERROR) << "Failed to (re-)create table 'join_test'";
16218  return -EEXIST;
16219  }
16220  try {
16222  } catch (...) {
16223  LOG(ERROR) << "Failed to (re-)create table 'hash_join_test'";
16224  return -EEXIST;
16225  }
16226  try {
16227  import_coalesce_cols_join_test(0, with_delete_support);
16228  import_coalesce_cols_join_test(1, with_delete_support);
16229  import_coalesce_cols_join_test(2, with_delete_support);
16230  } catch (...) {
16231  LOG(ERROR) << "Failed to (re-)create table for coalesce col join test "
16232  "('coalesce_cols_join_0', "
16233  "'coalesce_cols_join_1', 'coalesce_cols_join_2')";
16234  return -EEXIST;
16235  }
16236  try {
16237  import_emp_table();
16238  } catch (...) {
16239  LOG(ERROR) << "Failed to (re-)create table 'emp'";
16240  return -EEXIST;
16241  }
16242  try {
16244  } catch (...) {
16245  LOG(ERROR) << "Failed to (re-)create table 'dept'";
16246  return -EEXIST;
16247  }
16248  try {
16250  } catch (...) {
16251  LOG(ERROR) << "Failed to (re-)create table 'geospatial_test'";
16252  return -EEXIST;
16253  }
16254  try {
16256  } catch (...) {
16257  LOG(ERROR) << "Failed to (re-)create table 'geospatial_inner_join_test'";
16258  }
16259  try {
16260  const std::string drop_old_empty{"DROP TABLE IF EXISTS emptytab;"};
16261  run_ddl_statement(drop_old_empty);
16262  g_sqlite_comparator.query(drop_old_empty);
16263 
16264  const std::string create_empty{
16265  "CREATE TABLE emptytab(x int not null, y int, t bigint not null, f float not "
16266  "null, d double not null, dd "
16267  "decimal(10, 2) not null, ts timestamp)"};
16268  run_ddl_statement(create_empty + " WITH (partitions='REPLICATED');");
16269  g_sqlite_comparator.query(create_empty + ";");
16270  } catch (...) {
16271  LOG(ERROR) << "Failed to (re-)create table 'emptytab'";
16272  return -EEXIST;
16273  }
16274  try {
16275  const std::string drop_old_empty2{"DROP TABLE IF EXISTS emptytab2;"};
16276  run_ddl_statement(drop_old_empty2);
16277  g_sqlite_comparator.query(drop_old_empty2);
16278 
16280  "CREATE TABLE emptytab2(x int, shard key (x)) WITH (shard_count=4);");
16281  g_sqlite_comparator.query("CREATE TABLE emptytab2(x int);");
16282  } catch (...) {
16283  LOG(ERROR) << "Failed to (re-)create table 'emptytab2'";
16284  return -EEXIST;
16285  }
16286  try {
16287  const std::string drop_old_test_in_bitmap{"DROP TABLE IF EXISTS test_in_bitmap;"};
16288  run_ddl_statement(drop_old_test_in_bitmap);
16289  g_sqlite_comparator.query(drop_old_test_in_bitmap);
16290  const std::string create_test_in_bitmap{
16291  "CREATE TABLE test_in_bitmap(str TEXT ENCODING DICT);"};
16292  run_ddl_statement(create_test_in_bitmap);
16293  g_sqlite_comparator.query("CREATE TABLE test_in_bitmap(str TEXT);");
16294  } catch (...) {
16295  LOG(ERROR) << "Failed to (re-)create table 'test_in_bitmap'";
16296  return -EEXIST;
16297  }
16298  try {
16300  } catch (...) {
16301  LOG(ERROR) << "Failed to (re-)create table 'logical_size_test'";
16302  }
16303  try {
16305  } catch (...) {
16306  LOG(ERROR) << "Failed to (re-)create table 'empty_table_test'";
16307  }
16308  try {
16310  } catch (...) {
16311  LOG(ERROR) << "Failed to (re-)create table 'test_lots_cols'";
16312  }
16313  {
16314  std::string insert_query{"INSERT INTO test_in_bitmap VALUES('a');"};
16316  g_sqlite_comparator.query(insert_query);
16317  }
16318  {
16319  std::string insert_query{"INSERT INTO test_in_bitmap VALUES('b');"};
16321  g_sqlite_comparator.query(insert_query);
16322  }
16323  {
16324  std::string insert_query{"INSERT INTO test_in_bitmap VALUES('c');"};
16326  g_sqlite_comparator.query(insert_query);
16327  }
16328  {
16329  std::string insert_query{"INSERT INTO test_in_bitmap VALUES(NULL);"};
16331  g_sqlite_comparator.query(insert_query);
16332  }
16333 
16335  if (rc) {
16336  return rc;
16337  }
16338 
16340  if (err) {
16341  return err;
16342  }
16343 
16344  return 0;
16345 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
#define LOG(tag)
Definition: Logger.h:182
bool g_aggregator
Definition: ExecuteTest.cpp:46
void query(const std::string &query_string)
void import_array_test(const std::string &table_name)
int create_sharded_join_table(const std::string &table_name, size_t fragment_size, size_t num_rows, const ShardInfo &shard_info, bool with_delete_support=true)
Catalog & getCatalog() const
Definition: SessionInfo.h:90
void import_geospatial_join_test(const bool replicate_inner_table=false)
static QueryRunner * get()
Definition: QueryRunner.h:115
void import_join_test(bool with_delete_support)
void import_coalesce_cols_join_test(const int id, bool with_delete_support)
#define CHECK(condition)
Definition: Logger.h:187
Catalog_Namespace::SessionInfo * getSession() const
Definition: QueryRunner.h:124
void run_ddl_statement(std::string ddl)
std::string build_create_table_statement(const std::string &columns_definition, const std::string &table_name, const ShardInfo &shard_info, const std::vector< SharedDictionaryInfo > &shared_dict_info, const size_t fragment_size, const bool delete_support=true, const bool replicated=false)
Definition: ExecuteTest.cpp:91
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_and_populate_window_func_table()

int anonymous_namespace{ExecuteTest.cpp}::create_and_populate_window_func_table ( )

Definition at line 15429 of file ExecuteTest.cpp.

References CPU, logger::ERROR, g_sqlite_comparator, LOG, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

15429  {
15430  try {
15431  const std::string drop_test_table{"DROP TABLE IF EXISTS test_window_func;"};
15432  run_ddl_statement(drop_test_table);
15433  g_sqlite_comparator.query(drop_test_table);
15434  const std::string create_test_table{
15435  "CREATE TABLE test_window_func(x INTEGER, y TEXT, t INTEGER, d DATE, f FLOAT, dd "
15436  "DOUBLE);"};
15437  run_ddl_statement(create_test_table);
15438  g_sqlite_comparator.query(create_test_table);
15439  {
15440  const std::string insert_query{
15441  "INSERT INTO test_window_func VALUES(1, 'aaa', 4, '2019-03-02', 1, 1);"};
15443  g_sqlite_comparator.query(insert_query);
15444  }
15445  {
15446  const std::string insert_query{
15447  "INSERT INTO test_window_func VALUES(0, 'aaa', 5, '2019-03-01', 0, 0);"};
15449  g_sqlite_comparator.query(insert_query);
15450  }
15451  {
15452  const std::string insert_query{
15453  "INSERT INTO test_window_func VALUES(2, 'ccc', 6, '2019-03-03', 2, 2);"};
15455  g_sqlite_comparator.query(insert_query);
15456  }
15457  {
15458  const std::string insert_query{
15459  "INSERT INTO test_window_func VALUES(10, 'bbb', 7, '2019-03-11', 10, 10);"};
15461  g_sqlite_comparator.query(insert_query);
15462  }
15463  {
15464  const std::string insert_query{
15465  "INSERT INTO test_window_func VALUES(3, 'bbb', 8, '2019-03-04', 3, 3);"};
15467  g_sqlite_comparator.query(insert_query);
15468  }
15469  {
15470  const std::string insert_query{
15471  "INSERT INTO test_window_func VALUES(6, 'bbb', 9, '2019-03-07', 6, 6);"};
15473  g_sqlite_comparator.query(insert_query);
15474  }
15475  {
15476  const std::string insert_query{
15477  "INSERT INTO test_window_func VALUES(9, 'bbb', 10, '2019-03-10', 9, 9);"};
15479  g_sqlite_comparator.query(insert_query);
15480  }
15481  {
15482  const std::string insert_query{
15483  "INSERT INTO test_window_func VALUES(6, 'bbb', 11, '2019-03-07', 6, 6);"};
15485  g_sqlite_comparator.query(insert_query);
15486  }
15487  {
15488  const std::string insert_query{
15489  "INSERT INTO test_window_func VALUES(9, 'bbb', 12, '2019-03-10', 9, 9);"};
15491  g_sqlite_comparator.query(insert_query);
15492  }
15493  {
15494  const std::string insert_query{
15495  "INSERT INTO test_window_func VALUES(9, 'bbb', 13, '2019-03-10', 9, 9);"};
15497  g_sqlite_comparator.query(insert_query);
15498  }
15499  {
15500  const std::string insert_query{
15501  "INSERT INTO test_window_func VALUES(NULL, NULL, 14, NULL, NULL, NULL);"};
15503  g_sqlite_comparator.query(insert_query);
15504  }
15505  } catch (...) {
15506  LOG(ERROR) << "Failed to (re-)create table 'test_window_func'";
15507  return -EEXIST;
15508  }
15509  return 0;
15510 }
#define LOG(tag)
Definition: Logger.h:182
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_as_select()

int anonymous_namespace{ExecuteTest.cpp}::create_as_select ( )

Definition at line 16387 of file ExecuteTest.cpp.

References logger::ERROR, g_sqlite_comparator, LOG, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), and run_ddl_statement().

Referenced by main().

16387  {
16388  try {
16389  const std::string drop_ctas_test{"DROP TABLE IF EXISTS ctas_test;"};
16390  run_ddl_statement(drop_ctas_test);
16391  g_sqlite_comparator.query(drop_ctas_test);
16392  const std::string create_ctas_test{
16393  "CREATE TABLE ctas_test AS SELECT x, f, d, str, fixed_str FROM test WHERE x > "
16394  "7;"};
16395  run_ddl_statement(create_ctas_test);
16396  g_sqlite_comparator.query(create_ctas_test);
16397  } catch (...) {
16398  LOG(ERROR) << "Failed to (re-)create table 'ctas_test'";
16399  return -EEXIST;
16400  }
16401  return 0;
16402 }
#define LOG(tag)
Definition: Logger.h:182
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_as_select_empty()

int anonymous_namespace{ExecuteTest.cpp}::create_as_select_empty ( )

Definition at line 16404 of file ExecuteTest.cpp.

References logger::ERROR, g_sqlite_comparator, LOG, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), and run_ddl_statement().

Referenced by main().

16404  {
16405  try {
16406  const std::string drop_ctas_test{"DROP TABLE IF EXISTS empty_ctas_test;"};
16407  run_ddl_statement(drop_ctas_test);
16408  g_sqlite_comparator.query(drop_ctas_test);
16409  const std::string create_ctas_test{
16410  "CREATE TABLE empty_ctas_test AS SELECT x, f, d, str, fixed_str FROM test WHERE "
16411  "x > 8;"};
16412  run_ddl_statement(create_ctas_test);
16413  g_sqlite_comparator.query(create_ctas_test);
16414  } catch (...) {
16415  LOG(ERROR) << "Failed to (re-)create table 'empty_ctas_test'";
16416  return -EEXIST;
16417  }
16418  return 0;
16419 }
#define LOG(tag)
Definition: Logger.h:182
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_sharded_join_table()

int anonymous_namespace{ExecuteTest.cpp}::create_sharded_join_table ( const std::string &  table_name,
size_t  fragment_size,
size_t  num_rows,
const ShardInfo shard_info,
bool  with_delete_support = true 
)

Definition at line 15382 of file ExecuteTest.cpp.

References build_create_table_statement(), CPU, logger::ERROR, g_sqlite_comparator, logger::INFO, LOG, num_rows, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), run_multiple_agg(), and to_string().

Referenced by create_and_populate_tables().

15386  {
15387  std::string columns_definition{"i INTEGER, j INTEGER, s TEXT ENCODING DICT(32)"};
15388 
15389  try {
15390  std::string drop_ddl{"DROP TABLE IF EXISTS " + table_name + ";"};
15391  run_ddl_statement(drop_ddl);
15392  g_sqlite_comparator.query(drop_ddl);
15393 
15394  const auto create_ddl = build_create_table_statement(columns_definition,
15395  table_name,
15396  shard_info,
15397  {},
15398  fragment_size,
15399  with_delete_support);
15400  run_ddl_statement(create_ddl);
15401  g_sqlite_comparator.query("CREATE TABLE " + table_name + "(i int, j int, s text);");
15402 
15403  const std::vector<std::string> alphabet{"a", "b", "c", "d", "e", "f", "g", "h", "i",
15404  "j", "k", "l", "m", "n", "o", "p", "q", "r",
15405  "s", "t", "u", "v", "w", "x", "y", "z"};
15406  const auto alphabet_sz = alphabet.size();
15407 
15408  int i = 0;
15409  int j = num_rows;
15410  for (size_t x = 0; x < num_rows; x++) {
15411  const std::string insert_query{"INSERT INTO " + table_name + " VALUES(" +
15412  std::to_string(i) + "," + std::to_string(j) + ",'" +
15413  alphabet[i % alphabet_sz] + "');"};
15414  LOG(INFO) << insert_query;
15415 
15417  g_sqlite_comparator.query(insert_query);
15418  i++;
15419  j--;
15420  }
15421  } catch (const std::exception& e) {
15422  LOG(ERROR) << "Failed to (re-)create tables for Inner Join sharded test: "
15423  << e.what();
15424  return -EEXIST;
15425  }
15426  return 0;
15427 }
const int8_t const int64_t * num_rows
#define LOG(tag)
Definition: Logger.h:182
std::string to_string(char const *&&v)
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
std::string build_create_table_statement(const std::string &columns_definition, const std::string &table_name, const ShardInfo &shard_info, const std::vector< SharedDictionaryInfo > &shared_dict_info, const size_t fragment_size, const bool delete_support=true, const bool replicated=false)
Definition: ExecuteTest.cpp:91
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_views()

int anonymous_namespace{ExecuteTest.cpp}::create_views ( )

Definition at line 16347 of file ExecuteTest.cpp.

References logger::ERROR, g_sqlite_comparator, LOG, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), and run_ddl_statement().

16347  {
16348  const std::string create_view_test{
16349  "CREATE VIEW view_test AS SELECT test.*, test_inner.* FROM test, test_inner WHERE "
16350  "test.str = test_inner.str;"};
16351  const std::string drop_old_view{"DROP VIEW IF EXISTS view_test;"};
16352  const std::string create_join_view_test{
16353  "CREATE VIEW join_view_test AS SELECT a.x AS x FROM test a JOIN test_inner b ON "
16354  "a.str = b.str;"};
16355  const std::string drop_old_join_view{"DROP VIEW IF EXISTS join_view_test;"};
16356  try {
16357  run_ddl_statement(drop_old_view);
16358  run_ddl_statement(create_view_test);
16359  } catch (...) {
16360  LOG(ERROR) << "Failed to (re-)create view 'view_test' -- run_ddl_statement";
16361  return -EEXIST;
16362  }
16363  try {
16364  g_sqlite_comparator.query(drop_old_view);
16365  g_sqlite_comparator.query(create_view_test);
16366  } catch (...) {
16367  LOG(ERROR) << "Failed to (re-)create view 'view_test' -- g_sqlite_comparator";
16368  return -EEXIST;
16369  }
16370  try {
16371  run_ddl_statement(drop_old_join_view);
16372  run_ddl_statement(create_join_view_test);
16373  } catch (...) {
16374  LOG(ERROR) << "Failed to (re-)create view 'join_view_test' -- run_ddl_statement";
16375  return -EEXIST;
16376  }
16377  try {
16378  g_sqlite_comparator.query(drop_old_join_view);
16379  g_sqlite_comparator.query(create_join_view_test);
16380  } catch (...) {
16381  LOG(ERROR) << "Failed to (re-)create view 'join_view_test' -- g_sqlite_comparator";
16382  return -EEXIST;
16383  }
16384  return 0;
16385 }
#define LOG(tag)
Definition: Logger.h:182
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:

◆ cta()

void anonymous_namespace{ExecuteTest.cpp}::cta ( const std::string &  query_string,
const ExecutorDeviceType  device_type 
)

Definition at line 455 of file ExecuteTest.cpp.

References anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::compare_timstamp_approx().

Referenced by TEST().

455  {
456  g_sqlite_comparator.compare_timstamp_approx(query_string, device_type);
457 }
void compare_timstamp_approx(const std::string &query_string, const ExecutorDeviceType device_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drop_tables()

void anonymous_namespace{ExecuteTest.cpp}::drop_tables ( )

Definition at line 16421 of file ExecuteTest.cpp.

References g_aggregator, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), and run_ddl_statement().

16421  {
16422  const std::string drop_vacuum_test_alt("DROP TABLE vacuum_test_alt;");
16423  g_sqlite_comparator.query(drop_vacuum_test_alt);
16424  const std::string drop_test_inner{"DROP TABLE test_inner;"};
16425  run_ddl_statement(drop_test_inner);
16426  g_sqlite_comparator.query(drop_test_inner);
16427  const std::string drop_test{"DROP TABLE test;"};
16428  run_ddl_statement(drop_test);
16429  g_sqlite_comparator.query(drop_test);
16430  const std::string drop_test_empty{"DROP TABLE test_empty;"};
16431  run_ddl_statement(drop_test_empty);
16432  g_sqlite_comparator.query(drop_test_empty);
16433  const std::string test_one_row{"DROP TABLE test_one_row;"};
16434  run_ddl_statement(test_one_row);
16435  g_sqlite_comparator.query(test_one_row);
16436  const std::string drop_test_inner_x{"DROP TABLE test_inner_x;"};
16437  run_ddl_statement(drop_test_inner_x);
16438  g_sqlite_comparator.query(drop_test_inner_x);
16439  const std::string drop_test_inner_y{"DROP TABLE test_inner_y;"};
16440  run_ddl_statement(drop_test_inner_y);
16441  g_sqlite_comparator.query(drop_test_inner_y);
16442 #if 0
16443  const std::string drop_test_inner_deleted{"DROP TABLE test_inner_deleted;"};
16444  run_ddl_statement(drop_test_inner_deleted);
16445  g_sqlite_comparator.query(drop_test_inner_deleted);
16446 #endif
16447  const std::string drop_bar{"DROP TABLE bar;"};
16448  run_ddl_statement(drop_bar);
16449  g_sqlite_comparator.query(drop_bar);
16450  const std::string drop_proj_top{"DROP TABLE proj_top;"};
16451  run_ddl_statement(drop_proj_top);
16452  g_sqlite_comparator.query(drop_proj_top);
16453  const std::string drop_test_x{"DROP TABLE test_x;"};
16454  run_ddl_statement(drop_test_x);
16455  g_sqlite_comparator.query(drop_test_x);
16456  const std::string drop_gpu_sort_test{"DROP TABLE gpu_sort_test;"};
16457  run_ddl_statement(drop_gpu_sort_test);
16458  g_sqlite_comparator.query(drop_gpu_sort_test);
16459  const std::string drop_query_rewrite_test{"DROP TABLE query_rewrite_test;"};
16460  run_ddl_statement(drop_query_rewrite_test);
16461  const std::string drop_big_decimal_range_test{"DROP TABLE big_decimal_range_test;"};
16462  run_ddl_statement(drop_big_decimal_range_test);
16463  const std::string drop_decimal_compression_test{"DROP TABLE decimal_compression_test;"};
16464  run_ddl_statement(drop_decimal_compression_test);
16465  g_sqlite_comparator.query(drop_query_rewrite_test);
16466  const std::string drop_array_test{"DROP TABLE array_test;"};
16467  run_ddl_statement(drop_array_test);
16468  const std::string drop_array_test_inner{"DROP TABLE array_test_inner;"};
16469  run_ddl_statement(drop_array_test_inner);
16470  const std::string drop_single_row_test{"DROP TABLE single_row_test;"};
16471  g_sqlite_comparator.query(drop_single_row_test);
16472  run_ddl_statement(drop_single_row_test);
16473  const std::string drop_subquery_test{"DROP TABLE subquery_test;"};
16474  run_ddl_statement(drop_subquery_test);
16475  g_sqlite_comparator.query(drop_subquery_test);
16476  const std::string drop_empty_test{"DROP TABLE emptytab;"};
16477  run_ddl_statement(drop_empty_test);
16478  const std::string drop_empty_test2{"DROP TABLE emptytab2;"};
16479  run_ddl_statement(drop_empty_test2);
16480  g_sqlite_comparator.query(drop_empty_test);
16481  run_ddl_statement("DROP TABLE text_group_by_test;");
16482  const std::string drop_join_test{"DROP TABLE join_test;"};
16483  run_ddl_statement(drop_join_test);
16484  g_sqlite_comparator.query(drop_join_test);
16485  const std::string drop_hash_join_test{"DROP TABLE hash_join_test;"};
16486  run_ddl_statement(drop_hash_join_test);
16487  g_sqlite_comparator.query(drop_hash_join_test);
16488  const std::string drop_coalesce_join_test_0{"DROP TABLE coalesce_cols_test_0"};
16489  run_ddl_statement(drop_coalesce_join_test_0);
16490  g_sqlite_comparator.query(drop_coalesce_join_test_0);
16491  const std::string drop_coalesce_join_test_1{"DROP TABLE coalesce_cols_test_1"};
16492  run_ddl_statement(drop_coalesce_join_test_1);
16493  g_sqlite_comparator.query(drop_coalesce_join_test_1);
16494  const std::string drop_coalesce_join_test_2{"DROP TABLE coalesce_cols_test_2"};
16495  run_ddl_statement(drop_coalesce_join_test_2);
16496  g_sqlite_comparator.query(drop_coalesce_join_test_2);
16497  const std::string drop_emp_table{"DROP TABLE emp;"};
16498  g_sqlite_comparator.query(drop_emp_table);
16499  run_ddl_statement(drop_emp_table);
16500  const std::string drop_dept_table{"DROP TABLE dept;"};
16501  g_sqlite_comparator.query(drop_dept_table);
16502  run_ddl_statement(drop_dept_table);
16503  run_ddl_statement("DROP TABLE geospatial_test;");
16504  const std::string drop_test_in_bitmap{"DROP TABLE test_in_bitmap;"};
16505  g_sqlite_comparator.query(drop_test_in_bitmap);
16506  run_ddl_statement(drop_test_in_bitmap);
16507  const std::string drop_logical_size_test{"DROP TABLE logical_size_test;"};
16508  g_sqlite_comparator.query(drop_logical_size_test);
16509  run_ddl_statement(drop_logical_size_test);
16510  const std::string drop_empty_test_table{"DROP TABLE empty_test_table;"};
16511  g_sqlite_comparator.query(drop_empty_test_table);
16512  run_ddl_statement(drop_empty_test_table);
16513  const std::string drop_test_lots_cols{"DROP TABLE test_lots_cols;"};
16514  g_sqlite_comparator.query(drop_test_lots_cols);
16515  run_ddl_statement(drop_test_lots_cols);
16516 
16517  if (!g_aggregator) {
16518  const std::string drop_ctas_test{"DROP TABLE ctas_test;"};
16519  g_sqlite_comparator.query(drop_ctas_test);
16520  run_ddl_statement(drop_ctas_test);
16521 
16522  const std::string drop_empty_ctas_test{"DROP TABLE empty_ctas_test;"};
16523  g_sqlite_comparator.query(drop_empty_ctas_test);
16524  run_ddl_statement(drop_empty_ctas_test);
16525  }
16526 
16527  const std::string drop_test_table_rounding{"DROP TABLE test_rounding;"};
16528  run_ddl_statement(drop_test_table_rounding);
16529  g_sqlite_comparator.query(drop_test_table_rounding);
16530  const std::string drop_test_window_func{"DROP TABLE test_window_func;"};
16531  run_ddl_statement(drop_test_window_func);
16532  g_sqlite_comparator.query(drop_test_window_func);
16533 }
bool g_aggregator
Definition: ExecuteTest.cpp:46
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:

◆ drop_views()

void anonymous_namespace{ExecuteTest.cpp}::drop_views ( )

Definition at line 16535 of file ExecuteTest.cpp.

References g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), and run_ddl_statement().

16535  {
16536  const std::string drop_view_test{"DROP VIEW view_test;"};
16537  run_ddl_statement(drop_view_test);
16538  g_sqlite_comparator.query(drop_view_test);
16539  const std::string drop_join_view_test{"DROP VIEW join_view_test;"};
16540  run_ddl_statement(drop_join_view_test);
16541  g_sqlite_comparator.query(drop_join_view_test);
16542 }
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:

◆ get_first_target()

TargetValue anonymous_namespace{ExecuteTest.cpp}::get_first_target ( const string &  query_str,
const ExecutorDeviceType  device_type,
const bool  geo_return_geo_tv = true 
)

Definition at line 159 of file ExecuteTest.cpp.

References CHECK_GE, ResultSet::GeoTargetValue, and run_multiple_agg().

Referenced by TEST().

161  {
162  auto rows = run_multiple_agg(query_str, device_type);
163  if (geo_return_geo_tv) {
164  rows->setGeoReturnType(ResultSet::GeoReturnType::GeoTargetValue);
165  }
166  auto crt_row = rows->getNextRow(true, true);
167  CHECK_GE(crt_row.size(), size_t(1)) << query_str;
168  return crt_row[0];
169 }
#define CHECK_GE(x, y)
Definition: Logger.h:200
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_array_test()

void anonymous_namespace{ExecuteTest.cpp}::import_array_test ( const std::string &  table_name)

Definition at line 4864 of file ExecuteTest.cpp.

References Importer_NS::CopyParams::array_begin, Importer_NS::CopyParams::array_end, CHECK, CHECK_EQ, g_array_test_row_count, QueryRunner::QueryRunner::get(), Catalog_Namespace::SessionInfo::getCatalog(), QueryRunner::QueryRunner::getLoader(), Catalog_Namespace::Catalog::getMetadataForTable(), QueryRunner::QueryRunner::getSession(), join(), kARRAY, kBIGINT, kBOOLEAN, kDOUBLE, kENCODING_DICT, kFLOAT, kINT, kSMALLINT, kTEXT, kTINYINT, Importer_NS::StringToArray(), and to_string().

Referenced by create_and_populate_tables().

4864  {
4865  CHECK_EQ(size_t(0), g_array_test_row_count % 4);
4866  auto& cat = QR::get()->getSession()->getCatalog();
4867  const auto td = cat.getMetadataForTable(table_name);
4868  CHECK(td);
4869  auto loader = QR::get()->getLoader(td);
4870  std::vector<std::unique_ptr<Importer_NS::TypedImportBuffer>> import_buffers;
4871  const auto col_descs =
4872  cat.getAllColumnMetadataForTable(td->tableId, false, false, false);
4873  for (const auto cd : col_descs) {
4874  import_buffers.emplace_back(new Importer_NS::TypedImportBuffer(
4875  cd,
4876  cd->columnType.get_compression() == kENCODING_DICT
4877  ? cat.getMetadataForDict(cd->columnType.get_comp_param())->stringDict.get()
4878  : nullptr));
4879  }
4880  Importer_NS::CopyParams copy_params;
4881  copy_params.array_begin = '{';
4882  copy_params.array_end = '}';
4883  for (size_t row_idx = 0; row_idx < g_array_test_row_count; ++row_idx) {
4884  for (const auto& import_buffer : import_buffers) {
4885  const auto& ti = import_buffer->getTypeInfo();
4886  switch (ti.get_type()) {
4887  case kINT:
4888  import_buffer->addInt(7 + row_idx);
4889  break;
4890  case kARRAY: {
4891  const auto& elem_ti = ti.get_elem_type();
4892  std::vector<std::string> array_elems;
4893  switch (elem_ti.get_type()) {
4894  case kBOOLEAN: {
4895  for (size_t i = 0; i < 3; ++i) {
4896  if (row_idx % 2) {
4897  array_elems.emplace_back("T");
4898  array_elems.emplace_back("F");
4899  } else {
4900  array_elems.emplace_back("F");
4901  array_elems.emplace_back("T");
4902  }
4903  }
4904  break;
4905  }
4906  case kTINYINT:
4907  for (size_t i = 0; i < 3; ++i) {
4908  array_elems.push_back(std::to_string(row_idx + i + 1));
4909  }
4910  break;
4911  case kSMALLINT:
4912  for (size_t i = 0; i < 3; ++i) {
4913  array_elems.push_back(std::to_string(row_idx + i + 1));
4914  }
4915  break;
4916  case kINT:
4917  for (size_t i = 0; i < 3; ++i) {
4918  array_elems.push_back(std::to_string((row_idx + i + 1) * 10));
4919  }
4920  break;
4921  case kBIGINT:
4922  for (size_t i = 0; i < 3; ++i) {
4923  array_elems.push_back(std::to_string((row_idx + i + 1) * 100));
4924  }
4925  break;
4926  case kTEXT:
4927  for (size_t i = 0; i < 3; ++i) {
4928  array_elems.emplace_back(2, 'a' + row_idx + i);
4929  }
4930  break;
4931  case kFLOAT:
4932  for (size_t i = 0; i < 3; ++i) {
4933  array_elems.emplace_back(std::to_string(row_idx + i + 1) + "." +
4934  std::to_string(row_idx + i + 1));
4935  }
4936  break;
4937  case kDOUBLE:
4938  for (size_t i = 0; i < 3; ++i) {
4939  array_elems.emplace_back(std::to_string(11 * (row_idx + i + 1)) + "." +
4940  std::to_string(row_idx + i + 1));
4941  }
4942  break;
4943  default:
4944  CHECK(false);
4945  }
4946  if (elem_ti.is_string()) {
4947  import_buffer->addDictEncodedStringArray({array_elems});
4948  } else {
4949  auto arr_str = "{" + boost::algorithm::join(array_elems, ",") + "}";
4950  import_buffer->addArray(StringToArray(arr_str, ti, copy_params));
4951  }
4952  break;
4953  }
4954  case kTEXT:
4955  import_buffer->addString("real_str" + std::to_string(row_idx));
4956  break;
4957  default:
4958  CHECK(false);
4959  }
4960  }
4961  }
4962  loader->load(import_buffers, g_array_test_row_count);
4963 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
std::string join(T const &container, std::string const &delim)
ArrayDatum StringToArray(const std::string &s, const SQLTypeInfo &ti, const CopyParams &copy_params)
Definition: Importer.cpp:441
std::string to_string(char const *&&v)
virtual std::unique_ptr< Importer_NS::Loader > getLoader(const TableDescriptor *td) const
Catalog & getCatalog() const
Definition: SessionInfo.h:90
static QueryRunner * get()
Definition: QueryRunner.h:115
Definition: sqltypes.h:54
#define CHECK(condition)
Definition: Logger.h:187
Definition: sqltypes.h:47
Catalog_Namespace::SessionInfo * getSession() const
Definition: QueryRunner.h:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_big_decimal_range_test()

void anonymous_namespace{ExecuteTest.cpp}::import_big_decimal_range_test ( )

Definition at line 5006 of file ExecuteTest.cpp.

References CPU, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5006  {
5007  const std::string drop_old_decimal_range_test(
5008  "DROP TABLE IF EXISTS big_decimal_range_test;");
5009  run_ddl_statement(drop_old_decimal_range_test);
5010  g_sqlite_comparator.query(drop_old_decimal_range_test);
5012  "CREATE TABLE big_decimal_range_test(d DECIMAL(14, 2), d1 DECIMAL(17,11)) WITH "
5013  "(fragment_size=2);");
5015  "CREATE TABLE big_decimal_range_test(d DECIMAL(14, 2), d1 DECIMAL(17,11));");
5016  {
5017  const std::string insert_query{
5018  "INSERT INTO big_decimal_range_test VALUES(-40840124.400000, 1.3);"};
5020  g_sqlite_comparator.query(insert_query);
5021  }
5022  {
5023  const std::string insert_query{
5024  "INSERT INTO big_decimal_range_test VALUES(59016609.300000, 1.3);"};
5026  g_sqlite_comparator.query(insert_query);
5027  }
5028  {
5029  const std::string insert_query{
5030  "INSERT INTO big_decimal_range_test VALUES(-999999999999.99, 1.3);"};
5032  g_sqlite_comparator.query(insert_query);
5033  }
5034 }
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_coalesce_cols_join_test()

void anonymous_namespace{ExecuteTest.cpp}::import_coalesce_cols_join_test ( const int  id,
bool  with_delete_support 
)

Definition at line 5176 of file ExecuteTest.cpp.

References build_create_table_statement(), CPU, g_aggregator, g_shard_count, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), run_multiple_agg(), and to_string().

Referenced by create_and_populate_tables().

5176  {
5177  const std::string table_name = "coalesce_cols_test_" + std::to_string(id);
5178  const std::string drop_old_test{"DROP TABLE IF EXISTS " + table_name + ";"};
5179  run_ddl_statement(drop_old_test);
5180  g_sqlite_comparator.query(drop_old_test);
5181 
5182  std::string columns_definition{
5183  "x int not null, y int, str text encoding dict, dup_str text encoding dict, d "
5184  "date, t time, tz timestamp, dn decimal(5)"};
5185  const auto create_test = build_create_table_statement(columns_definition,
5186  table_name,
5187  {"", g_shard_count},
5188  {},
5189 
5190  id == 2 ? 2 : 20,
5191  with_delete_support,
5192  g_aggregator);
5193  run_ddl_statement(create_test);
5194 
5195  g_sqlite_comparator.query("CREATE TABLE " + table_name +
5196  "(x int not null, y int, str text, dup_str text, d date, t "
5197  "time, tz timestamp, dn decimal(5));");
5198  TestHelpers::ValuesGenerator gen(table_name);
5199  for (int i = 0; i < 5; i++) {
5200  const auto insert_query = gen(i,
5201  20 - i,
5202  "'test'",
5203  "'test'",
5204  "'2018-01-01'",
5205  "'12:34:56'",
5206  "'2018-01-01 12:34:56'",
5207  i * 1.1);
5209  g_sqlite_comparator.query(insert_query);
5210  }
5211  for (size_t i = 5; i < 10; i++) {
5212  const auto insert_query = gen(i,
5213  20 - i,
5214  "'test1'",
5215  "'test1'",
5216  "'2017-01-01'",
5217  "'12:34:00'",
5218  "'2017-01-01 12:34:56'",
5219  i * 1.1);
5221  g_sqlite_comparator.query(insert_query);
5222  }
5223  if (id > 0) {
5224  for (size_t i = 10; i < 15; i++) {
5225  const auto insert_query = gen(i,
5226  20 - i,
5227  "'test2'",
5228  "'test2'",
5229  "'2016-01-01'",
5230  "'12:00:56'",
5231  "'2016-01-01 12:34:56'",
5232  i * 1.1);
5234  g_sqlite_comparator.query(insert_query);
5235  }
5236  }
5237  if (id > 1) {
5238  for (size_t i = 15; i < 20; i++) {
5239  const auto insert_query = gen(i,
5240  20 - i,
5241  "'test3'",
5242  "'test3'",
5243  "'2015-01-01'",
5244  "'10:34:56'",
5245  "'2015-01-01 12:34:56'",
5246  i * 1.1);
5248  g_sqlite_comparator.query(insert_query);
5249  }
5250  }
5251 }
std::string to_string(char const *&&v)
bool g_aggregator
Definition: ExecuteTest.cpp:46
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
std::string build_create_table_statement(const std::string &columns_definition, const std::string &table_name, const ShardInfo &shard_info, const std::vector< SharedDictionaryInfo > &shared_dict_info, const size_t fragment_size, const bool delete_support=true, const bool replicated=false)
Definition: ExecuteTest.cpp:91
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_decimal_compression_test()

void anonymous_namespace{ExecuteTest.cpp}::import_decimal_compression_test ( )

Definition at line 5036 of file ExecuteTest.cpp.

References CPU, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5036  {
5037  const std::string decimal_compression_test(
5038  "DROP TABLE IF EXISTS decimal_compression_test;");
5039  run_ddl_statement(decimal_compression_test);
5040  g_sqlite_comparator.query(decimal_compression_test);
5042  "CREATE TABLE decimal_compression_test(big_dec DECIMAL(17, 2), med_dec DECIMAL(9, "
5043  "2), small_dec DECIMAL(4, 2)) WITH (fragment_size=2);");
5045  "CREATE TABLE decimal_compression_test(big_dec DECIMAL(17, 2), med_dec DECIMAL(9, "
5046  "2), small_dec DECIMAL(4, 2));");
5047  {
5048  const std::string insert_query{
5049  "INSERT INTO decimal_compression_test VALUES(999999999999999.99, 9999999.99, "
5050  "99.99);"};
5052  g_sqlite_comparator.query(insert_query);
5053  }
5054  {
5055  const std::string insert_query{
5056  "INSERT INTO decimal_compression_test VALUES(-999999999999999.99, -9999999.99, "
5057  "-99.99);"};
5059  g_sqlite_comparator.query(insert_query);
5060  }
5061  {
5062  const std::string insert_query{
5063  "INSERT INTO decimal_compression_test VALUES(12.2382, 12.2382 , 12.2382);"};
5065  // sqlite does not do automatic rounding
5066  const std::string sqlite_insert_query{
5067  "INSERT INTO decimal_compression_test VALUES(12.24, 12.24 , 12.24);"};
5068  g_sqlite_comparator.query(sqlite_insert_query);
5069  }
5070 }
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_dept_table()

void anonymous_namespace{ExecuteTest.cpp}::import_dept_table ( )

Definition at line 5285 of file ExecuteTest.cpp.

References CPU, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5285  {
5286  const std::string drop_old_test{"DROP TABLE IF EXISTS dept;"};
5287  run_ddl_statement(drop_old_test);
5288  g_sqlite_comparator.query(drop_old_test);
5289  const std::string create_test{
5290  "CREATE TABLE dept(deptno INT, dname TEXT ENCODING DICT) WITH (fragment_size=2);"};
5291  run_ddl_statement(create_test);
5292  g_sqlite_comparator.query("CREATE TABLE dept(deptno INT, dname TEXT ENCODING DICT);");
5293  {
5294  const std::string insert_query{"INSERT INTO dept VALUES(10, 'Sales');"};
5296  g_sqlite_comparator.query(insert_query);
5297  }
5298  {
5299  const std::string insert_query{"INSERT INTO dept VALUES(20, 'Dev');"};
5301  g_sqlite_comparator.query(insert_query);
5302  }
5303  {
5304  const std::string insert_query{"INSERT INTO dept VALUES(30, 'Marketing');"};
5306  g_sqlite_comparator.query(insert_query);
5307  }
5308  {
5309  const std::string insert_query{"INSERT INTO dept VALUES(40, 'HR');"};
5311  g_sqlite_comparator.query(insert_query);
5312  }
5313  {
5314  const std::string insert_query{"INSERT INTO dept VALUES(50, 'QA');"};
5316  g_sqlite_comparator.query(insert_query);
5317  }
5318 }
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_emp_table()

void anonymous_namespace{ExecuteTest.cpp}::import_emp_table ( )

Definition at line 5253 of file ExecuteTest.cpp.

References CPU, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5253  {
5254  const std::string drop_old_test{"DROP TABLE IF EXISTS emp;"};
5255  run_ddl_statement(drop_old_test);
5256  g_sqlite_comparator.query(drop_old_test);
5257  const std::string create_test{
5258  "CREATE TABLE emp(empno INT, ename TEXT NOT NULL ENCODING DICT, deptno INT) WITH "
5259  "(fragment_size=2);"};
5260  run_ddl_statement(create_test);
5262  "CREATE TABLE emp(empno INT, ename TEXT NOT NULL, deptno INT);");
5263  {
5264  const std::string insert_query{"INSERT INTO emp VALUES(1, 'Brock', 10);"};
5266  g_sqlite_comparator.query(insert_query);
5267  }
5268  {
5269  const std::string insert_query{"INSERT INTO emp VALUES(2, 'Bill', 20);"};
5271  g_sqlite_comparator.query(insert_query);
5272  }
5273  {
5274  const std::string insert_query{"INSERT INTO emp VALUES(3, 'Julia', 60);"};
5276  g_sqlite_comparator.query(insert_query);
5277  }
5278  {
5279  const std::string insert_query{"INSERT INTO emp VALUES(4, 'David', 10);"};
5281  g_sqlite_comparator.query(insert_query);
5282  }
5283 }
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_empty_table_test()

void anonymous_namespace{ExecuteTest.cpp}::import_empty_table_test ( )

Definition at line 5464 of file ExecuteTest.cpp.

References g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), and run_ddl_statement().

Referenced by create_and_populate_tables().

5464  {
5465  const std::string drop_table{"DROP TABLE IF EXISTS empty_test_table;"};
5466  run_ddl_statement(drop_table);
5467  g_sqlite_comparator.query(drop_table);
5468  std::string create_statement(
5469  "CREATE TABLE empty_test_table (id int, x bigint, y int, z smallint, t tinyint, "
5470  "f float, d double);");
5471  run_ddl_statement(create_statement);
5472  g_sqlite_comparator.query(create_statement);
5473 }
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_geospatial_join_test()

void anonymous_namespace{ExecuteTest.cpp}::import_geospatial_join_test ( const bool  replicate_inner_table = false)

Definition at line 5367 of file ExecuteTest.cpp.

References build_create_table_statement(), CPU, g_aggregator, g_num_rows, run_ddl_statement(), run_multiple_agg(), and to_string().

Referenced by create_and_populate_tables().

5367  {
5368  // Create a single fragment inner table that is half the size of the geospatial_test
5369  // (outer) table
5370  const std::string drop_geospatial_test(
5371  "DROP TABLE IF EXISTS geospatial_inner_join_test;");
5372  run_ddl_statement(drop_geospatial_test);
5373  std::string column_definition =
5374  "id INT, p POINT, l LINESTRING, poly POLYGON, mpoly MULTIPOLYGON";
5375  auto create_statement = build_create_table_statement(column_definition,
5376  "geospatial_inner_join_test",
5377  {"", 0},
5378  {},
5379  20,
5380  true,
5381  g_aggregator);
5382  run_ddl_statement(create_statement);
5383  TestHelpers::ValuesGenerator gen("geospatial_inner_join_test");
5384  for (ssize_t i = 0; i < g_num_rows; i += 2) {
5385  const std::string point{"'POINT(" + std::to_string(i) + " " + std::to_string(i) +
5386  ")'"};
5387  const std::string linestring{
5388  "'LINESTRING(" + std::to_string(i) + " 0, " + std::to_string(2 * i) + " " +
5389  std::to_string(2 * i) +
5390  ((i % 2) ? (", " + std::to_string(2 * i + 1) + " " + std::to_string(2 * i + 1))
5391  : "") +
5392  ")'"};
5393  const std::string poly{"'POLYGON((0 0, " + std::to_string(i + 1) + " 0, 0 " +
5394  std::to_string(i + 1) + ", 0 0))'"};
5395  const std::string mpoly{"'MULTIPOLYGON(((0 0, " + std::to_string(i + 1) + " 0, 0 " +
5396  std::to_string(i + 1) + ", 0 0)))'"};
5397  run_multiple_agg(gen(i, point, linestring, poly, mpoly), ExecutorDeviceType::CPU);
5398  }
5399 }
std::string to_string(char const *&&v)
bool g_aggregator
Definition: ExecuteTest.cpp:46
void run_ddl_statement(std::string ddl)
std::string build_create_table_statement(const std::string &columns_definition, const std::string &table_name, const ShardInfo &shard_info, const std::vector< SharedDictionaryInfo > &shared_dict_info, const size_t fragment_size, const bool delete_support=true, const bool replicated=false)
Definition: ExecuteTest.cpp:91
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_geospatial_test()

void anonymous_namespace{ExecuteTest.cpp}::import_geospatial_test ( )

Definition at line 5320 of file ExecuteTest.cpp.

References CPU, g_num_rows, run_ddl_statement(), run_multiple_agg(), and to_string().

Referenced by create_and_populate_tables().

5320  {
5321  const std::string geospatial_test("DROP TABLE IF EXISTS geospatial_test;");
5322  run_ddl_statement(geospatial_test);
5323  constexpr char create_ddl[] = R"(CREATE TABLE geospatial_test (
5324  id INT,
5325  p POINT,
5326  l LINESTRING,
5327  poly POLYGON,
5328  mpoly MULTIPOLYGON,
5329  gp GEOMETRY(POINT),
5330  gp4326 GEOMETRY(POINT,4326) ENCODING COMPRESSED(32),
5331  gp4326none GEOMETRY(POINT,4326) ENCODING NONE,
5332  gp900913 GEOMETRY(POINT,900913),
5333  gl4326none GEOMETRY(LINESTRING,4326) ENCODING NONE,
5334  gpoly4326 GEOMETRY(POLYGON,4326)
5335  ) WITH (fragment_size=2);
5336  )";
5337  run_ddl_statement(create_ddl);
5338  TestHelpers::ValuesGenerator gen("geospatial_test");
5339  for (ssize_t i = 0; i < g_num_rows; ++i) {
5340  const std::string point{"'POINT(" + std::to_string(i) + " " + std::to_string(i) +
5341  ")'"};
5342  const std::string linestring{
5343  "'LINESTRING(" + std::to_string(i) + " 0, " + std::to_string(2 * i) + " " +
5344  std::to_string(2 * i) +
5345  ((i % 2) ? (", " + std::to_string(2 * i + 1) + " " + std::to_string(2 * i + 1))
5346  : "") +
5347  ")'"};
5348  const std::string poly{"'POLYGON((0 0, " + std::to_string(i + 1) + " 0, 0 " +
5349  std::to_string(i + 1) + ", 0 0))'"};
5350  const std::string mpoly{"'MULTIPOLYGON(((0 0, " + std::to_string(i + 1) + " 0, 0 " +
5351  std::to_string(i + 1) + ", 0 0)))'"};
5352  run_multiple_agg(gen(i,
5353  point,
5354  linestring,
5355  poly,
5356  mpoly,
5357  point,
5358  point,
5359  point,
5360  point,
5361  linestring,
5362  poly),
5364  }
5365 }
std::string to_string(char const *&&v)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_gpu_sort_test()

void anonymous_namespace{ExecuteTest.cpp}::import_gpu_sort_test ( )

Definition at line 4965 of file ExecuteTest.cpp.

References CPU, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

4965  {
4966  const std::string drop_old_gpu_sort_test{"DROP TABLE IF EXISTS gpu_sort_test;"};
4967  run_ddl_statement(drop_old_gpu_sort_test);
4968  g_sqlite_comparator.query(drop_old_gpu_sort_test);
4969  std::string create_query(
4970  "CREATE TABLE gpu_sort_test (x bigint, y int, z smallint, t tinyint)");
4971  run_ddl_statement(create_query + " WITH (fragment_size=2);");
4972  g_sqlite_comparator.query(create_query + ";");
4973  TestHelpers::ValuesGenerator gen("gpu_sort_test");
4974  for (size_t i = 0; i < 4; ++i) {
4975  const auto insert_query = gen(2, 2, 2, 2);
4977  g_sqlite_comparator.query(insert_query);
4978  }
4979  for (size_t i = 0; i < 6; ++i) {
4980  const auto insert_query = gen(16000, 16000, 16000, 127);
4982  g_sqlite_comparator.query(insert_query);
4983  }
4984 }
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_hash_join_test()

void anonymous_namespace{ExecuteTest.cpp}::import_hash_join_test ( )

Definition at line 5144 of file ExecuteTest.cpp.

References CPU, g_aggregator, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5144  {
5145  const std::string drop_old_test{"DROP TABLE IF EXISTS hash_join_test;"};
5146  run_ddl_statement(drop_old_test);
5147  g_sqlite_comparator.query(drop_old_test);
5148 
5149  std::string replicated_dec{!g_aggregator ? "" : ", PARTITIONS='REPLICATED'"};
5150 
5151  const std::string create_test{
5152  "CREATE TABLE hash_join_test(x int not null, str text encoding dict, t BIGINT) "
5153  "WITH (fragment_size=2" +
5154  replicated_dec + ");"};
5155  run_ddl_statement(create_test);
5157  "CREATE TABLE hash_join_test(x int not null, str text, t BIGINT);");
5158  {
5159  const std::string insert_query{"INSERT INTO hash_join_test VALUES(7, 'foo', 1001);"};
5161  g_sqlite_comparator.query(insert_query);
5162  }
5163  {
5164  const std::string insert_query{
5165  "INSERT INTO hash_join_test VALUES(8, 'bar', 5000000000);"};
5167  g_sqlite_comparator.query(insert_query);
5168  }
5169  {
5170  const std::string insert_query{"INSERT INTO hash_join_test VALUES(9, 'the', 1002);"};
5172  g_sqlite_comparator.query(insert_query);
5173  }
5174 }
bool g_aggregator
Definition: ExecuteTest.cpp:46
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_join_test()

void anonymous_namespace{ExecuteTest.cpp}::import_join_test ( bool  with_delete_support)

Definition at line 5108 of file ExecuteTest.cpp.

References build_create_table_statement(), CPU, g_aggregator, g_shard_count, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5108  {
5109  const std::string drop_old_test{"DROP TABLE IF EXISTS join_test;"};
5110  run_ddl_statement(drop_old_test);
5111  g_sqlite_comparator.query(drop_old_test);
5112  std::string columns_definition{
5113  "x int not null, y int, str text encoding dict, dup_str text encoding dict"};
5114  const auto create_test =
5115  build_create_table_statement(columns_definition,
5116  "join_test",
5117  {g_shard_count ? "dup_str" : "", g_shard_count},
5118  {},
5119  2,
5120  with_delete_support,
5121  g_aggregator);
5122  run_ddl_statement(create_test);
5124  "CREATE TABLE join_test(x int not null, y int, str text, dup_str text);");
5125  {
5126  const std::string insert_query{"INSERT INTO join_test VALUES(7, 43, 'foo', 'foo');"};
5128  g_sqlite_comparator.query(insert_query);
5129  }
5130  {
5131  const std::string insert_query{
5132  "INSERT INTO join_test VALUES(8, null, 'bar', 'foo');"};
5134  g_sqlite_comparator.query(insert_query);
5135  }
5136  {
5137  const std::string insert_query{
5138  "INSERT INTO join_test VALUES(9, null, 'baz', 'bar');"};
5140  g_sqlite_comparator.query(insert_query);
5141  }
5142 }
bool g_aggregator
Definition: ExecuteTest.cpp:46
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
std::string build_create_table_statement(const std::string &columns_definition, const std::string &table_name, const ShardInfo &shard_info, const std::vector< SharedDictionaryInfo > &shared_dict_info, const size_t fragment_size, const bool delete_support=true, const bool replicated=false)
Definition: ExecuteTest.cpp:91
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_logical_size_test()

void anonymous_namespace{ExecuteTest.cpp}::import_logical_size_test ( )

Definition at line 5401 of file ExecuteTest.cpp.

References CPU, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5401  {
5402  const std::string table_name("logical_size_test");
5403  const std::string drop_old_logical_size_test{"DROP TABLE IF EXISTS " + table_name +
5404  ";"};
5405  run_ddl_statement(drop_old_logical_size_test);
5406  g_sqlite_comparator.query(drop_old_logical_size_test);
5407  std::string create_table_str("CREATE TABLE " + table_name + "(");
5408  create_table_str += "big_int BIGINT NOT NULL, big_int_null BIGINT, ";
5409  create_table_str += "id INT NOT NULL, id_null INT, ";
5410  create_table_str += "small_int SMALLINT NOT NULL, small_int_null SMALLINT, ";
5411  create_table_str += "tiny_int TINYINT NOT NULL, tiny_int_null TINYINT, ";
5412  create_table_str += "float_not_null FLOAT NOT NULL, float_null FLOAT, ";
5413  create_table_str += "double_not_null DOUBLE NOT NULL, double_null DOUBLE)";
5414  run_ddl_statement(create_table_str + " with (fragment_size = 4);");
5415  g_sqlite_comparator.query(create_table_str + ";");
5416 
5417  auto query_maker = [&table_name](std::string str) {
5418  return "INSERT INTO " + table_name + " VALUES (" + str + ");";
5419  };
5420 
5421  std::vector<std::string> insert_queries;
5422  // fragment 0:
5423  insert_queries.push_back(
5424  query_maker("2002, -57, 7, 0, 73, 32767, 22, 127, 1.5, NULL, 11.5, -21.6"));
5425  insert_queries.push_back(
5426  query_maker("1001, 63, 6, NULL, 77, -32767, 21, NULL, 1.6, 1.1, 11.6, NULL"));
5427  insert_queries.push_back(
5428  query_maker("3003, 63, 5, 2, 79, NULL, 23, 125, 1.5, -1.3, 11.5, 22.3"));
5429  insert_queries.push_back(
5430  query_maker("3003, NULL, 4, 6, 78, 0, 20, 126, 1.7, -1.5, 11.7, 22.5"));
5431  // fragment 1:
5432  insert_queries.push_back(
5433  query_maker("2002, NULL, 4, NULL, 75, -112, -13, -125, 2.5, -2.3, 22.5, -23.5"));
5434  insert_queries.push_back(
5435  query_maker("1001, -57, 6, 2, 77, NULL, -14, -126, 2.6, NULL, 22.6, 23.7"));
5436  insert_queries.push_back(
5437  query_maker("1001, 63, 7, 0, 78, -32767, -15, NULL, 2.7, 2.7, 22.7, NULL"));
5438  insert_queries.push_back(
5439  query_maker("1001, -57, 5, 6, 79, 32767, -12, -127, 2.6, -2.4, 22.6, -23.4"));
5440  // fragment 2:
5441  insert_queries.push_back(
5442  query_maker("3003, 63, 5, 2, 79, -32767, 4, NULL, 3.6, 3.3, 32.6, -33.3"));
5443  insert_queries.push_back(
5444  query_maker("2002, -57, 7, 4, 76, 32767, 2, -1, 3.5, -3.7, 32.5, 33.7"));
5445  insert_queries.push_back(
5446  query_maker("3003, NULL, 4, NULL, 77, NULL, 3, -2, 3.7, NULL, 32.7, -33.5"));
5447  insert_queries.push_back(
5448  query_maker("1001, -57, 6, 0, 73, 2345, 1, -3, 3.4, 32.4, 32.5, NULL"));
5449  // fragment 3:
5450  insert_queries.push_back(
5451  query_maker("1001, 63, 6, 4, 77, 0, 12, -3, 4.5, 4.3, 11.6, NULL"));
5452  insert_queries.push_back(
5453  query_maker("3003, -57, 4, 2, 78, 32767, 16, -1, 4.6, 4.1, 11.5, 22.3"));
5454  insert_queries.push_back(
5455  query_maker("2002, 63, 7, 6, 75, -32767, 13, -2, 4.7, -4.1, 22.7, -33.3"));
5456  insert_queries.push_back(
5457  query_maker("2002, NULL, 5, NULL, 76, NULL, 15, NULL, 4.4, NULL, 22.5, -23.4"));
5458  for (auto insert_query : insert_queries) {
5460  g_sqlite_comparator.query(insert_query);
5461  }
5462 }
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_query_rewrite_test()

void anonymous_namespace{ExecuteTest.cpp}::import_query_rewrite_test ( )

Definition at line 4986 of file ExecuteTest.cpp.

References CPU, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), run_multiple_agg(), and to_string().

Referenced by create_and_populate_tables().

4986  {
4987  const std::string drop_old_query_rewrite_test{
4988  "DROP TABLE IF EXISTS query_rewrite_test;"};
4989  run_ddl_statement(drop_old_query_rewrite_test);
4990  g_sqlite_comparator.query(drop_old_query_rewrite_test);
4992  "CREATE TABLE query_rewrite_test(x int, str text encoding dict) WITH "
4993  "(fragment_size=2);");
4994  g_sqlite_comparator.query("CREATE TABLE query_rewrite_test(x int, str text);");
4995  for (size_t i = 1; i <= 30; ++i) {
4996  for (size_t j = 1; j <= i % 2 + 1; ++j) {
4997  const std::string insert_query{"INSERT INTO query_rewrite_test VALUES(" +
4998  std::to_string(i) + ", 'str" + std::to_string(i) +
4999  "');"};
5001  g_sqlite_comparator.query(insert_query);
5002  }
5003  }
5004 }
std::string to_string(char const *&&v)
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_subquery_test()

void anonymous_namespace{ExecuteTest.cpp}::import_subquery_test ( )

Definition at line 5072 of file ExecuteTest.cpp.

References CHECK_EQ, CPU, g_num_rows, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5072  {
5073  const std::string subquery_test("DROP TABLE IF EXISTS subquery_test;");
5074  run_ddl_statement(subquery_test);
5075  g_sqlite_comparator.query(subquery_test);
5076  run_ddl_statement("CREATE TABLE subquery_test(x int) WITH (fragment_size=2);");
5077  g_sqlite_comparator.query("CREATE TABLE subquery_test(x int);");
5078  CHECK_EQ(g_num_rows % 2, 0);
5079  for (ssize_t i = 0; i < g_num_rows; ++i) {
5080  const std::string insert_query{"INSERT INTO subquery_test VALUES(7);"};
5082  g_sqlite_comparator.query(insert_query);
5083  }
5084  for (ssize_t i = 0; i < g_num_rows / 2; ++i) {
5085  const std::string insert_query{"INSERT INTO subquery_test VALUES(8);"};
5087  g_sqlite_comparator.query(insert_query);
5088  }
5089  for (ssize_t i = 0; i < g_num_rows / 2; ++i) {
5090  const std::string insert_query{"INSERT INTO subquery_test VALUES(9);"};
5092  g_sqlite_comparator.query(insert_query);
5093  }
5094 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_test_table_with_lots_of_columns()

void anonymous_namespace{ExecuteTest.cpp}::import_test_table_with_lots_of_columns ( )

Definition at line 5475 of file ExecuteTest.cpp.

References CPU, g_sqlite_comparator, anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::query(), run_ddl_statement(), run_multiple_agg(), and to_string().

Referenced by create_and_populate_tables().

5475  {
5476  const size_t num_columns = 50;
5477  const std::string table_name("test_lots_cols");
5478  const std::string drop_table("DROP TABLE IF EXISTS " + table_name + ";");
5479  run_ddl_statement(drop_table);
5480  g_sqlite_comparator.query(drop_table);
5481  std::string create_query("CREATE TABLE " + table_name + "(");
5482  std::string insert_query1("INSERT INTO " + table_name + " VALUES (");
5483  std::string insert_query2(insert_query1);
5484 
5485  for (size_t i = 0; i < num_columns - 1; i++) {
5486  create_query += ("x" + std::to_string(i) + " INTEGER, ");
5487  insert_query1 += (std::to_string(i) + ", ");
5488  insert_query2 += (std::to_string(10000 + i) + ", ");
5489  }
5490  create_query += "real_str TEXT";
5491  insert_query1 += "'real_foo');";
5492  insert_query2 += "'real_bar');";
5493 
5494  run_ddl_statement(create_query + " ENCODING NONE) with (fragment_size = 2);");
5495  g_sqlite_comparator.query(create_query + ");");
5496 
5497  for (size_t i = 0; i < 10; i++) {
5498  run_multiple_agg(i % 2 ? insert_query2 : insert_query1, ExecutorDeviceType::CPU);
5499  g_sqlite_comparator.query(i % 2 ? insert_query2 : insert_query1);
5500  }
5501 }
std::string to_string(char const *&&v)
void query(const std::string &query_string)
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_text_group_by_test()

void anonymous_namespace{ExecuteTest.cpp}::import_text_group_by_test ( )

Definition at line 5096 of file ExecuteTest.cpp.

References CPU, run_ddl_statement(), and run_multiple_agg().

Referenced by create_and_populate_tables().

5096  {
5097  const std::string text_group_by_test("DROP TABLE IF EXISTS text_group_by_test;");
5098  run_ddl_statement(text_group_by_test);
5100  "CREATE TABLE text_group_by_test(tdef TEXT, tdict TEXT ENCODING DICT, tnone TEXT "
5101  "ENCODING NONE ) WITH "
5102  "(fragment_size=200);");
5103  const std::string insert_query{
5104  "INSERT INTO text_group_by_test VALUES('hello','world',':-)');"};
5106 }
void run_ddl_statement(std::string ddl)
TQueryResult run_multiple_agg(std::string sql)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_fractional_seconds()

int anonymous_namespace{ExecuteTest.cpp}::parse_fractional_seconds ( uint  sfrac,
int  ntotal,
SQLTypeInfo ti 
)

Definition at line 189 of file ExecuteTest.cpp.

References SQLTypeInfoCore< TYPE_FACET_PACK >::get_dimension(), TimeGM::instance(), and TimeGM::parse_fractional_seconds().

Referenced by anonymous_namespace{ExecuteTest.cpp}::SQLiteComparator::compare_impl().

189  {
190  return TimeGM::instance().parse_fractional_seconds(sfrac, ntotal, ti.get_dimension());
191 }
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:325
time_t parse_fractional_seconds(uint64_t sfrac, const int32_t ntotal, const int32_t dimen)
Definition: timegm.cpp:52
static TimeGM & instance()
Definition: TimeGM.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run_ddl_statement()

void anonymous_namespace{ExecuteTest.cpp}::run_ddl_statement ( const std::string &  create_table_stmt)
inline

Definition at line 171 of file ExecuteTest.cpp.

References QueryRunner::QueryRunner::get(), and QueryRunner::QueryRunner::runDDLStatement().

171  {
172  QR::get()->runDDLStatement(create_table_stmt);
173 }
virtual void runDDLStatement(const std::string &)
static QueryRunner * get()
Definition: QueryRunner.h:115
+ Here is the call graph for this function:

◆ run_multiple_agg() [1/2]

std::shared_ptr<ResultSet> anonymous_namespace{ExecuteTest.cpp}::run_multiple_agg ( const string &  query_str,
const ExecutorDeviceType  device_type,
const bool  allow_loop_joins 
)

Definition at line 135 of file ExecuteTest.cpp.

References g_hoist_literals, QueryRunner::QueryRunner::get(), and QueryRunner::QueryRunner::runSQL().

137  {
138  return QR::get()->runSQL(query_str, device_type, g_hoist_literals, allow_loop_joins);
139 }
virtual std::shared_ptr< ResultSet > runSQL(const std::string &query_str, const ExecutorDeviceType device_type, const bool hoist_literals=true, const bool allow_loop_joins=true)
static QueryRunner * get()
Definition: QueryRunner.h:115
+ Here is the call graph for this function:

◆ run_multiple_agg() [2/2]

std::shared_ptr<ResultSet> anonymous_namespace{ExecuteTest.cpp}::run_multiple_agg ( const string &  query_str,
const ExecutorDeviceType  device_type 
)

Definition at line 141 of file ExecuteTest.cpp.

References g_hoist_literals, QueryRunner::QueryRunner::get(), and QueryRunner::QueryRunner::runSQL().

142  {
143  return QR::get()->runSQL(query_str, device_type, g_hoist_literals, true);
144 }
virtual std::shared_ptr< ResultSet > runSQL(const std::string &query_str, const ExecutorDeviceType device_type, const bool hoist_literals=true, const bool allow_loop_joins=true)
static QueryRunner * get()
Definition: QueryRunner.h:115
+ Here is the call graph for this function:

◆ run_simple_agg()

TargetValue anonymous_namespace{ExecuteTest.cpp}::run_simple_agg ( const string &  query_str,
const ExecutorDeviceType  device_type,
const bool  geo_return_geo_tv = true,
const bool  allow_loop_joins = true 
)

Definition at line 146 of file ExecuteTest.cpp.

References CHECK_EQ, ResultSet::GeoTargetValue, QueryRunner::QueryRunner::get(), and QueryRunner::QueryRunner::runSQL().

Referenced by TEST(), and TEST_F().

149  {
150  auto rows = QR::get()->runSQL(query_str, device_type, allow_loop_joins);
151  if (geo_return_geo_tv) {
152  rows->setGeoReturnType(ResultSet::GeoReturnType::GeoTargetValue);
153  }
154  auto crt_row = rows->getNextRow(true, true);
155  CHECK_EQ(size_t(1), crt_row.size()) << query_str;
156  return crt_row[0];
157 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
virtual std::shared_ptr< ResultSet > runSQL(const std::string &query_str, const ExecutorDeviceType device_type, const bool hoist_literals=true, const bool allow_loop_joins=true)
static QueryRunner * get()
Definition: QueryRunner.h:115
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ skip_tests()

bool anonymous_namespace{ExecuteTest.cpp}::skip_tests ( const ExecutorDeviceType  device_type)

Definition at line 175 of file ExecuteTest.cpp.

References QueryRunner::QueryRunner::get(), GPU, and QueryRunner::QueryRunner::gpusPresent().

Referenced by TEST().

175  {
176 #ifdef HAVE_CUDA
177  return device_type == ExecutorDeviceType::GPU && !(QR::get()->gpusPresent());
178 #else
179  return device_type == ExecutorDeviceType::GPU;
180 #endif
181 }
static QueryRunner * get()
Definition: QueryRunner.h:115
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validate_shard_agg()

void anonymous_namespace{ExecuteTest.cpp}::validate_shard_agg ( const ResultSet rows,
const std::vector< std::pair< int64_t, int64_t >> &  expected 
)

Definition at line 6534 of file ExecuteTest.cpp.

References CHECK, and CHECK_EQ.

Referenced by TEST().

6535  {
6536  ASSERT_EQ(static_cast<size_t>(expected.size()), rows.rowCount(false));
6537  for (size_t i = 0; i < rows.rowCount(false); ++i) {
6538  const auto crt_row = rows.getNextRow(true, true);
6539  CHECK_EQ(size_t(2), crt_row.size());
6540  const auto id = v<int64_t>(crt_row[0]);
6541  ASSERT_EQ(expected[i].first, id);
6542  const auto cnt = v<int64_t>(crt_row[1]);
6543  ASSERT_EQ(expected[i].second, cnt);
6544  }
6545  const auto crt_row = rows.getNextRow(true, true);
6546  CHECK(crt_row.empty());
6547 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the caller graph for this function:

◆ validate_storage_options()

void anonymous_namespace{ExecuteTest.cpp}::validate_storage_options ( const std::pair< std::string, bool >  type_meta,
const std::pair< std::string, std::vector< std::string >>  values 
)

Definition at line 492 of file ExecuteTest.cpp.

References anonymous_namespace{UpdateMetadataTest.cpp}::query, run_ddl_statement(), and validate_statement_syntax().

Referenced by TEST().

494  {
495  auto validate = [&type_meta](const std::string& add_column, const std::string& val) {
496  ASSERT_NO_THROW(run_ddl_statement("DROP TABLE IF EXISTS chelsea_storage;"));
497  const std::string query =
498  "CREATE TABLE chelsea_storage(id TEXT ENCODING DICT(32), val INT " + add_column +
499  ") WITH (" + type_meta.first + "=" + val + ");";
500  ASSERT_EQ(true, validate_statement_syntax(query));
501  if (type_meta.second) {
502  ASSERT_THROW(run_ddl_statement(query), std::runtime_error);
503  } else {
504  ASSERT_NO_THROW(run_ddl_statement(query));
505  }
506  };
507  for (const auto& val : values.second) {
508  validate(values.first, val);
509  }
510 }
bool validate_statement_syntax(const std::string &stmt)
void run_ddl_statement(std::string ddl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validate_timestamp_agg()

void anonymous_namespace{ExecuteTest.cpp}::validate_timestamp_agg ( const ResultSet row,
const int64_t  expected_ts,
const double  expected_mean,
const int64_t  expected_count 
)

Definition at line 10236 of file ExecuteTest.cpp.

Referenced by TEST().

10239  {
10240  const auto crt_row = row.getNextRow(true, true);
10241  if (!expected_count) {
10242  ASSERT_EQ(size_t(0), crt_row.size());
10243  return;
10244  }
10245  ASSERT_EQ(size_t(3), crt_row.size());
10246  const auto actual_ts = v<int64_t>(crt_row[0]);
10247  ASSERT_EQ(actual_ts, expected_ts);
10248  const auto actual_mean = v<double>(crt_row[1]);
10249  ASSERT_EQ(actual_mean, expected_mean);
10250  const auto actual_count = v<int64_t>(crt_row[2]);
10251  ASSERT_EQ(actual_count, expected_count);
10252  const auto nrow = row.getNextRow(true, true);
10253  ASSERT_TRUE(nrow.empty());
10254 }
+ Here is the caller graph for this function:

Variable Documentation

◆ g_array_test_row_count

const size_t anonymous_namespace{ExecuteTest.cpp}::g_array_test_row_count {20}

Definition at line 4862 of file ExecuteTest.cpp.

Referenced by import_array_test(), and TEST().

◆ g_hoist_literals

bool anonymous_namespace{ExecuteTest.cpp}::g_hoist_literals {true}

◆ g_keep_test_data

bool anonymous_namespace{ExecuteTest.cpp}::g_keep_test_data {false}

Definition at line 71 of file ExecuteTest.cpp.

Referenced by main(), and JoinTest::TearDown().

◆ g_num_leafs

size_t anonymous_namespace{ExecuteTest.cpp}::g_num_leafs {1}

Definition at line 70 of file ExecuteTest.cpp.

Referenced by choose_shard_count(), and TEST().

◆ g_num_rows

const ssize_t anonymous_namespace{ExecuteTest.cpp}::g_num_rows {10}

◆ g_shard_count

size_t anonymous_namespace{ExecuteTest.cpp}::g_shard_count {0}

◆ g_sqlite_comparator

◆ g_use_row_iterator

bool anonymous_namespace{ExecuteTest.cpp}::g_use_row_iterator {true}