OmniSciDB  04ee39c94c
anonymous_namespace{UpdelStorageTest.cpp} Namespace Reference

Classes

class  RowVacuumTest
 
class  RowVacuumTestWithVarlenAndArraysN
 
struct  ScalarTargetValueExtractor
 
class  UpdateStorageTest
 
struct  UpdelTestConfig
 

Typedefs

using ResultRow = std::vector< TargetValue >
 
using ResultRows = std::vector< ResultRow >
 
using RowVacuumTestWithVarlenAndArrays_0 = RowVacuumTestWithVarlenAndArraysN< 0 >
 
using ManualRowVacuumTestWithVarlenAndArrays = RowVacuumTestWithVarlenAndArraysN< varNumRowsByDefault/2 >
 
using RowVacuumTestWithVarlenAndArrays = RowVacuumTestWithVarlenAndArraysN< 0 >
 

Functions

void run_ddl_statement (const std::string &input_str)
 
template<class T >
v (const TargetValue &r)
 
std::shared_ptr< ResultSetrun_query (const std::string &query_str)
 
bool compare_agg (const std::string &table, const std::string &column, const int64_t cnt, const double avg)
 
template<typename T >
void update_prepare_offsets_values (const int64_t cnt, const int step, const T val, std::vector< uint64_t > &fragOffsets, std::vector< ScalarTargetValue > &rhsValues)
 
template<typename T >
void update_common (const std::string &table, const std::string &column, const int64_t cnt, const int step, const T &val, const SQLTypeInfo &rhsType, const bool commit=true)
 
bool update_a_numeric_column (const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
 
template<typename T >
bool nullize_a_fixed_encoded_column (const std::string &table, const std::string &column, const int64_t cnt)
 
const ResultRows get_some_rows (const std::string &table, const int limit=10)
 
template<typename T >
TargetValue targetValue (std::true_type, const std::vector< T > &vals)
 
template<typename T >
TargetValue targetValue (std::false_type, const T &val)
 
const std::string dumpv (const TargetValue &tv)
 
bool is_equal (const TargetValue &lhs, const TargetValue &rhs)
 
bool compare_row (const std::string &table, const std::string &column, const ResultRow &oldr, const ResultRow &newr, const TargetValue &val, const bool commit)
 
bool update_a_encoded_string_column (const std::string &table, const std::string &column, const int64_t cnt, const int step, const std::string &val, const bool commit=true)
 
bool update_a_boolean_column (const std::string &table, const std::string &column, const int64_t cnt, const int step, const bool val, const bool commit=true)
 
template<typename T >
bool update_column_from_decimal (const std::string &table, const std::string &column, const int64_t cnt, const int64_t rhsDecimal, const SQLTypeInfo &rhsType, const SQLTypeInfo &lhsType, const double max_loss, const bool commit=true)
 
void import_table_file (const std::string &table, const std::string &file)
 
bool prepare_table_for_delete (const std::string &table="trips", const std::string &column=UpdelTestConfig::sequence, const int64_t cnt=UpdelTestConfig::fixNumRows)
 
bool check_row_count_with_string (const std::string &table, const std::string &column, const int64_t cnt, const std::string &val)
 
bool delete_and_immediately_vacuum_rows (const std::string &table, const std::string &column, const std::string &deleted_column, const int64_t nall, const int dcnt, const int start, const int step)
 
bool delete_and_vacuum_varlen_rows (const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
 
void init_table_data (const std::string &table="trips", const std::string &create_table_cmd=create_table_trips, const std::string &file=UpdelTestConfig::fixFile)
 
 TEST_F (RowVacuumTestWithVarlenAndArrays_0, Vacuum_Half_Then_Add_All)
 
 TEST_F (ManualRowVacuumTestWithVarlenAndArrays, Vacuum_Half_First)
 
 TEST_F (ManualRowVacuumTestWithVarlenAndArrays, Vacuum_Half_Second)
 
 TEST_F (ManualRowVacuumTestWithVarlenAndArrays, Vacuum_Interleaved_2)
 
 TEST_F (ManualRowVacuumTestWithVarlenAndArrays, Vacuum_Interleaved_3)
 
 TEST_F (RowVacuumTestWithVarlenAndArrays, Vacuum_Half_First)
 
 TEST_F (RowVacuumTestWithVarlenAndArrays, Vacuum_Half_Second)
 
 TEST_F (RowVacuumTestWithVarlenAndArrays, Vacuum_Interleaved_2)
 
 TEST_F (RowVacuumTestWithVarlenAndArrays, Vacuum_Interleaved_3)
 
 TEST_F (RowVacuumTest, Vacuum_Half_First)
 
 TEST_F (RowVacuumTest, Vacuum_Half_Second)
 
 TEST_F (RowVacuumTest, Vacuum_Interleaved_2)
 
 TEST_F (RowVacuumTest, Vacuum_Interleaved_4)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_smallint_rate_code_id_null_8)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_smallint_rate_code_id_null_16)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_smallint_rate_code_id_null_32_throw)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_smallint_rate_code_id_null_64_throw)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_integer_passenger_count_null_16)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_integer_passenger_count_null_32)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_integer_passenger_count_null_64_throw)
 
 TEST_F (UpdateStorageTest, All_integer_trip_time_in_secs_null_32)
 
 TEST_F (UpdateStorageTest, All_integer_trip_time_in_secs_null_64_throw)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_smallint_rate_code_id_throw)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_10_0_LHS_decimal_19_5)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_10_2_LHS_decimal_19_5)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_15_2_LHS_decimal_19_5)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_17_2_LHS_decimal_19_5_throw)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_10_0_LHS_double)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_10_2_LHS_double)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_15_2_LHS_double)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_10_0_LHS_integer)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_10_2_LHS_integer)
 
 TEST_F (UpdateStorageTest, All_RHS_decimal_15_5_LHS_integer)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_integer_passenger_count_x1_throw)
 
 TEST_F (UpdateStorageTest, All_fixed_encoded_integer_passenger_count_x1_rollback)
 
 TEST_F (UpdateStorageTest, Half_fixed_encoded_integer_passenger_count_x2)
 
 TEST_F (UpdateStorageTest, Half_fixed_encoded_integer_passenger_count_x2_rollback)
 
 TEST_F (UpdateStorageTest, All_int_trip_time_in_secs_x2)
 
 TEST_F (UpdateStorageTest, All_int_trip_time_in_secs_x2_rollback)
 
 TEST_F (UpdateStorageTest, Half_int_trip_time_in_secs_x2)
 
 TEST_F (UpdateStorageTest, Half_int_trip_time_in_secs_x2_rollback)
 
 TEST_F (UpdateStorageTest, All_float_trip_distance_x2)
 
 TEST_F (UpdateStorageTest, All_float_trip_distance_x2_rollback)
 
 TEST_F (UpdateStorageTest, Half_float_trip_distance_x2)
 
 TEST_F (UpdateStorageTest, Half_float_trip_distance_x2_rollback)
 
 TEST_F (UpdateStorageTest, All_string_vendor_id)
 
 TEST_F (UpdateStorageTest, All_string_vendor_id_rollback)
 
 TEST_F (UpdateStorageTest, Half_string_vendor_id)
 
 TEST_F (UpdateStorageTest, Half_string_vendor_id_rollback)
 
 TEST_F (UpdateStorageTest, All_boolean_deleted)
 
 TEST_F (UpdateStorageTest, All_boolean_deleted_rollback)
 
 TEST_F (UpdateStorageTest, Half_boolean_deleted)
 
 TEST_F (UpdateStorageTest, Half_boolean_deleted_rollback)
 

Variables

static constexpr int varNumRowsByDefault = 8
 
static constexpr int fixNumRowsByDefault = 100
 
const std::string create_varlen_table1
 
const std::string create_varlen_table2
 
const std::string create_varlen_table3
 
const std::string create_table_trips
 

Typedef Documentation

◆ ManualRowVacuumTestWithVarlenAndArrays

using anonymous_namespace{UpdelStorageTest.cpp}::ManualRowVacuumTestWithVarlenAndArrays = typedef RowVacuumTestWithVarlenAndArraysN<varNumRowsByDefault / 2>

Definition at line 663 of file UpdelStorageTest.cpp.

◆ ResultRow

using anonymous_namespace{UpdelStorageTest.cpp}::ResultRow = typedef std::vector<TargetValue>

Definition at line 191 of file UpdelStorageTest.cpp.

◆ ResultRows

using anonymous_namespace{UpdelStorageTest.cpp}::ResultRows = typedef std::vector<ResultRow>

Definition at line 192 of file UpdelStorageTest.cpp.

◆ RowVacuumTestWithVarlenAndArrays

using anonymous_namespace{UpdelStorageTest.cpp}::RowVacuumTestWithVarlenAndArrays = typedef RowVacuumTestWithVarlenAndArraysN<0>

Definition at line 698 of file UpdelStorageTest.cpp.

◆ RowVacuumTestWithVarlenAndArrays_0

using anonymous_namespace{UpdelStorageTest.cpp}::RowVacuumTestWithVarlenAndArrays_0 = typedef RowVacuumTestWithVarlenAndArraysN<0>

Definition at line 637 of file UpdelStorageTest.cpp.

Function Documentation

◆ check_row_count_with_string()

bool anonymous_namespace{UpdelStorageTest.cpp}::check_row_count_with_string ( const std::string &  table,
const std::string &  column,
const int64_t  cnt,
const std::string &  val 
)

Definition at line 412 of file UpdelStorageTest.cpp.

References CHECK_EQ, run_query(), to_string(), and VLOG.

Referenced by delete_and_immediately_vacuum_rows().

415  {
416  std::string query_str =
417  "SELECT count(*) FROM " + table + " WHERE " + column + " = '" + val + "';";
418  auto rows = run_query(query_str);
419  auto crt_row = rows->getNextRow(true, true);
420  CHECK_EQ(size_t(1), crt_row.size());
421  auto r_cnt = v<int64_t>(crt_row[0]);
422  if (r_cnt == cnt) {
423  return true;
424  }
425  VLOG(1) << "r_cnt: " << std::to_string(r_cnt) << ", cnt: " << std::to_string(cnt);
426  return false;
427 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
std::string to_string(char const *&&v)
#define VLOG(n)
Definition: Logger.h:277
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_agg()

bool anonymous_namespace{UpdelStorageTest.cpp}::compare_agg ( const std::string &  table,
const std::string &  column,
const int64_t  cnt,
const double  avg 
)

Definition at line 106 of file UpdelStorageTest.cpp.

References CHECK_EQ, and run_query().

Referenced by delete_and_immediately_vacuum_rows(), prepare_table_for_delete(), and update_a_numeric_column().

109  {
110  std::string query_str = "SELECT COUNT(*), AVG(" + column + ") FROM " + table + ";";
111  auto rows = run_query(query_str);
112  auto crt_row = rows->getNextRow(true, true);
113  CHECK_EQ(size_t(2), crt_row.size());
114  auto r_cnt = v<int64_t>(crt_row[0]);
115  auto r_avg = v<double>(crt_row[1]);
116  // VLOG(1) << "r_avg: " << std::to_string(r_avg) << ", avg: " << std::to_string(avg);
117  return r_cnt == cnt && std::abs(r_avg - avg) < 1E-6;
118 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare_row()

bool anonymous_namespace{UpdelStorageTest.cpp}::compare_row ( const std::string &  table,
const std::string &  column,
const ResultRow oldr,
const ResultRow newr,
const TargetValue val,
const bool  commit 
)

Definition at line 266 of file UpdelStorageTest.cpp.

References anonymous_namespace{ExecuteTest.cpp}::c(), CHECK_EQ, dumpv(), QueryRunner::QueryRunner::get(), QueryRunner::QueryRunner::getCatalog(), is_equal(), run-benchmark-import::type, and VLOG.

Referenced by delete_and_vacuum_varlen_rows().

271  {
272  const auto cat = QR::get()->getCatalog();
273  const auto td = cat->getMetadataForTable(table);
274  const auto cdl = cat->getAllColumnMetadataForTable(td->tableId, false, false, false);
275  const auto cds = std::vector<const ColumnDescriptor*>(cdl.begin(), cdl.end());
276  const auto noldc = oldr.size();
277  const auto nnewc = newr.size();
278  const auto is_geophy_included = cds.size() < noldc;
279  CHECK_EQ(noldc, nnewc);
280  for (std::remove_const<decltype(noldc)>::type i = 0, c = 0; c < noldc;
281  c += is_geophy_included ? cds[i]->columnType.get_physical_cols() + 1 : 1, ++i) {
282  if (!is_equal(newr[c], (commit && cds[i]->columnName == column ? val : oldr[c]))) {
283  VLOG(1) << cds[i]->columnName << ": " << dumpv(newr[c]) << " - "
284  << dumpv((commit && cds[i]->columnName == column ? val : oldr[c]));
285  return false;
286  }
287  }
288  return true;
289 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
void c(const std::string &query_string, const ExecutorDeviceType device_type)
const std::string dumpv(const TargetValue &tv)
std::shared_ptr< Catalog_Namespace::Catalog > getCatalog() const
static QueryRunner * get()
Definition: QueryRunner.h:115
bool is_equal(const TargetValue &lhs, const TargetValue &rhs)
#define VLOG(n)
Definition: Logger.h:277
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete_and_immediately_vacuum_rows()

bool anonymous_namespace{UpdelStorageTest.cpp}::delete_and_immediately_vacuum_rows ( const std::string &  table,
const std::string &  column,
const std::string &  deleted_column,
const int64_t  nall,
const int  dcnt,
const int  start,
const int  step 
)

Definition at line 429 of file UpdelStorageTest.cpp.

References check_row_count_with_string(), UpdelRoll::commitUpdate(), compare_agg(), Data_Namespace::CPU_LEVEL, anonymous_namespace{ImportTest.cpp}::d(), measure< TimeT >::execution(), QueryRunner::QueryRunner::get(), QueryRunner::QueryRunner::getCatalog(), kBOOLEAN, prepare_table_for_delete(), and VLOG.

Referenced by TEST_F().

435  {
436  // set a column to "traceable" values
437  if (false == prepare_table_for_delete(table, column, nall)) {
438  return false;
439  }
440 
441  // pre calc expected count and sum of the traceable values
442  UpdelRoll updelRoll;
443  std::vector<uint64_t> fragOffsets;
444  std::vector<ScalarTargetValue> rhsValues;
445  rhsValues.emplace_back(int64_t{1});
446  int64_t sum = 0, cnt = 0;
447  for (int d = 0, i = start; d < dcnt; ++d, i += step) {
448  fragOffsets.push_back(i);
449  sum += i;
450  cnt += 1;
451  }
452 
453  // delete and vacuum rows supposedly immediately
454  auto cat = QR::get()->getCatalog().get();
455  auto td = cat->getMetadataForTable(table);
456  auto cd = cat->getMetadataForColumn(td->tableId, deleted_column);
457  const_cast<ColumnDescriptor*>(cd)->isDeletedCol = true;
458  auto ms = measure<>::execution([&]() {
459  td->fragmenter->updateColumn(cat,
460  td,
461  cd,
462  0, // 1st frag since we have only 100 rows
463  fragOffsets,
464  rhsValues,
465  SQLTypeInfo(kBOOLEAN, false),
467  updelRoll);
468  });
469  if (UpdelTestConfig::showMeasuredTime) {
470  VLOG(2) << "time on delete & vacuum " << dcnt << " of " << nall << " rows:" << ms
471  << " ms";
472  }
473  ms = measure<>::execution([&]() { updelRoll.commitUpdate(); });
474  if (UpdelTestConfig::showMeasuredTime) {
475  VLOG(2) << "time on commit:" << ms << " ms";
476  }
477  cnt = nall - cnt;
478  // check varlen column vacuumed
479  if (false == check_row_count_with_string(
480  table, "hack_license", cnt, "BA96DE419E711691B9445D6A6307C170")) {
481  return false;
482  }
483  return compare_agg(
484  table, column, cnt, ((0 + nall - 1) * nall / 2. - sum) / (cnt ? cnt : 1));
485 }
bool prepare_table_for_delete(const std::string &table="trips", const std::string &column=UpdelTestConfig::sequence, const int64_t cnt=UpdelTestConfig::fixNumRows)
void d(const SQLTypes expected_type, const std::string &str)
Definition: ImportTest.cpp:268
void commitUpdate()
bool check_row_count_with_string(const std::string &table, const std::string &column, const int64_t cnt, const std::string &val)
specifies the content in-memory of a row in the column metadata table
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
std::shared_ptr< Catalog_Namespace::Catalog > getCatalog() const
static QueryRunner * get()
Definition: QueryRunner.h:115
bool compare_agg(const std::string &table, const std::string &column, const int64_t cnt, const double avg)
static TimeT::rep execution(F func, Args &&... args)
Definition: sample.cpp:29
#define VLOG(n)
Definition: Logger.h:277
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete_and_vacuum_varlen_rows()

bool anonymous_namespace{UpdelStorageTest.cpp}::delete_and_vacuum_varlen_rows ( const std::string &  table,
const int  nall,
const int  ndel,
const int  start,
const int  step,
const bool  manual_vacuum 
)

Definition at line 487 of file UpdelStorageTest.cpp.

References compare_row(), anonymous_namespace{ImportTest.cpp}::d(), measure< TimeT >::execution(), QueryRunner::QueryRunner::get(), get_some_rows(), QueryRunner::QueryRunner::getCatalog(), Executor::getExecutor(), run_query(), to_string(), TableOptimizer::vacuumDeletedRows(), and VLOG.

Referenced by TEST_F().

492  {
493  const auto old_rows = get_some_rows(table, nall);
494 
495  std::vector<uint64_t> fragOffsets;
496  for (int d = 0, i = start; d < ndel && i < nall; ++d, i += step) {
497  fragOffsets.push_back(i);
498  }
499 
500  // delete and vacuum rows
501  auto cond = std::string("rowid >= ") + std::to_string(start) + " and mod(rowid-" +
502  std::to_string(start) + "," + std::to_string(step) + ")=0 and rowid < " +
503  std::to_string(start) + "+" + std::to_string(step) + "*" +
504  std::to_string(ndel);
505  auto ms = measure<>::execution([&]() {
506  ASSERT_NO_THROW(run_query("delete from " + table + " where " + cond + ";"););
507  });
508  if (UpdelTestConfig::showMeasuredTime) {
509  VLOG(2) << "time on delete " << (manual_vacuum ? "" : "& vacuum ")
510  << fragOffsets.size() << " rows:" << ms << " ms";
511  }
512 
513  if (manual_vacuum) {
514  ms = measure<>::execution([&]() {
515  auto cat = QR::get()->getCatalog().get();
516  const auto td = cat->getMetadataForTable(table,
517  /*populateFragmenter=*/true);
518  auto executor = Executor::getExecutor(cat->getCurrentDB().dbId);
519  TableOptimizer optimizer(td, executor.get(), *cat);
520  optimizer.vacuumDeletedRows();
521  optimizer.recomputeMetadata();
522  });
523  if (UpdelTestConfig::showMeasuredTime) {
524  VLOG(2) << "time on vacuum:" << ms << " ms";
525  }
526  }
527 
528  const auto new_rows = get_some_rows(table, nall);
529  if (!UpdelTestConfig::enableVarUpdelPerfTest) {
530  for (int oi = 0, ni = 0; oi < nall; ++oi) {
531  if (fragOffsets.end() == std::find(fragOffsets.begin(), fragOffsets.end(), oi)) {
532  if (!compare_row(table,
533  "",
534  old_rows[oi],
535  new_rows[ni++],
536  ScalarTargetValue(int64_t{1}),
537  false)) {
538  return false;
539  }
540  }
541  }
542  }
543  return true;
544 }
void d(const SQLTypes expected_type, const std::string &str)
Definition: ImportTest.cpp:268
static std::shared_ptr< Executor > getExecutor(const int db_id, const std::string &debug_dir="", const std::string &debug_file="", const MapDParameters mapd_parameters=MapDParameters(), ::QueryRenderer::QueryRenderManager *render_manager=nullptr)
Definition: Execute.cpp:122
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
const ResultRows get_some_rows(const std::string &table, const int limit=10)
Driver for running cleanup processes on a table. TableOptimizer provides functions for various cleanu...
std::string to_string(char const *&&v)
std::shared_ptr< Catalog_Namespace::Catalog > getCatalog() const
static QueryRunner * get()
Definition: QueryRunner.h:115
void vacuumDeletedRows() const
Compacts fragments to remove deleted rows. When a row is deleted, a boolean deleted system column is ...
bool compare_row(const std::string &table, const std::string &column, const ResultRow &oldr, const ResultRow &newr, const TargetValue &val, const bool commit)
static TimeT::rep execution(F func, Args &&... args)
Definition: sample.cpp:29
#define VLOG(n)
Definition: Logger.h:277
boost::variant< int64_t, double, float, NullableString > ScalarTargetValue
Definition: TargetValue.h:156
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dumpv()

const std::string anonymous_namespace{UpdelStorageTest.cpp}::dumpv ( const TargetValue tv)

Definition at line 229 of file UpdelStorageTest.cpp.

References join().

Referenced by compare_row().

229  {
230  std::ostringstream os;
231  if (const auto svp = boost::get<ScalarTargetValue>(&tv)) {
232  os << *svp;
233  } else if (const auto avp = boost::get<ArrayTargetValue>(&tv)) {
234  const auto& svp = avp->get();
236  svp | boost::adaptors::transformed(ScalarTargetValueExtractor()), ",");
237  }
238  return os.str();
239 }
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:

◆ get_some_rows()

const ResultRows anonymous_namespace{UpdelStorageTest.cpp}::get_some_rows ( const std::string &  table,
const int  limit = 10 
)

Definition at line 194 of file UpdelStorageTest.cpp.

References anonymous_namespace{ExecuteTest.cpp}::c(), run_query(), to_string(), and run-benchmark-import::type.

Referenced by delete_and_vacuum_varlen_rows().

194  {
195  ResultRows result_rows;
196  if (!UpdelTestConfig::enableVarUpdelPerfTest) {
197  std::string query_str =
198  "SELECT * FROM " + table + (limit ? " LIMIT " + std::to_string(limit) : "") + ";";
199  const auto rows = run_query(query_str);
200  // subtle here is we can't simply return ResultSet because it won't survive
201  // any rollback which wipes out all chunk data/metadata of the table, crashing
202  // UpdelRoll destructor that needs to free dirty chunks. So we need to copy
203  // the result rows out before the rollback ...
204  const auto nrow = rows->rowCount();
205  const auto ncol = rows->colCount();
206  for (std::remove_const<decltype(nrow)>::type r = 0; r < nrow; ++r) {
207  // translate string, or encoded strings won't be equal w/ boost ==
208  const auto row = rows->getNextRow(true, false);
209  std::vector<TargetValue> result_row;
210  for (std::remove_const<decltype(ncol)>::type c = 0; c < ncol; ++c) {
211  result_row.emplace_back(row[c]);
212  }
213  result_rows.emplace_back(result_row);
214  }
215  }
216  return result_rows;
217 }
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
void c(const std::string &query_string, const ExecutorDeviceType device_type)
std::string to_string(char const *&&v)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ import_table_file()

void anonymous_namespace{UpdelStorageTest.cpp}::import_table_file ( const std::string &  table,
const std::string &  file 
)

Definition at line 359 of file UpdelStorageTest.cpp.

References CHECK_EQ, QueryRunner::QueryRunner::get(), run-benchmark-import::parser, and QueryRunner::QueryRunner::runImport().

Referenced by init_table_data(), and TEST_F().

359  {
360  std::string query_str = std::string("COPY " + table + " FROM '") +
361  "../../Tests/Import/datafiles/" + file +
362  "' WITH (header='true');";
363 
364  SQLParser parser;
365  std::list<std::unique_ptr<Parser::Stmt>> parse_trees;
366  std::string last_parsed;
367  if (parser.parse(query_str, parse_trees, last_parsed)) {
368  throw std::runtime_error("Failed to parse: " + query_str);
369  }
370  CHECK_EQ(parse_trees.size(), size_t(1));
371 
372  const auto& stmt = parse_trees.front();
373  auto copy_stmt = dynamic_cast<Parser::CopyTableStmt*>(stmt.get());
374  if (!copy_stmt) {
375  throw std::runtime_error("Expected a CopyTableStatment: " + query_str);
376  }
377  QR::get()->runImport(copy_stmt);
378 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
virtual void runImport(Parser::CopyTableStmt *import_stmt)
static QueryRunner * get()
Definition: QueryRunner.h:115
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_table_data()

void anonymous_namespace{UpdelStorageTest.cpp}::init_table_data ( const std::string &  table = "trips",
const std::string &  create_table_cmd = create_table_trips,
const std::string &  file = UpdelTestConfig::fixFile 
)

Definition at line 601 of file UpdelStorageTest.cpp.

References measure< TimeT >::execution(), import_table_file(), run_ddl_statement(), and VLOG.

Referenced by anonymous_namespace{UpdelStorageTest.cpp}::RowVacuumTestWithVarlenAndArraysN< N >::SetUp(), anonymous_namespace{UpdelStorageTest.cpp}::RowVacuumTest::SetUp(), anonymous_namespace{UpdelStorageTest.cpp}::UpdateStorageTest::SetUp(), and TEST_F().

603  {
604  run_ddl_statement("drop table if exists " + table + ";");
605  run_ddl_statement(create_table_cmd + ";");
606  if (file.size()) {
607  auto ms = measure<>::execution([&]() { import_table_file(table, file); });
608  if (UpdelTestConfig::showMeasuredTime) {
609  VLOG(2) << "time on import: " << ms << " ms";
610  }
611  }
612 }
void import_table_file(const std::string &table, const std::string &file)
static TimeT::rep execution(F func, Args &&... args)
Definition: sample.cpp:29
void run_ddl_statement(std::string ddl)
#define VLOG(n)
Definition: Logger.h:277
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_equal()

bool anonymous_namespace{UpdelStorageTest.cpp}::is_equal ( const TargetValue lhs,
const TargetValue rhs 
)
inline

Definition at line 241 of file UpdelStorageTest.cpp.

References CHECK.

Referenced by compare_row().

241  {
242  CHECK(!(boost::get<GeoTargetValue>(&lhs) || boost::get<GeoTargetValue>(&rhs)));
243  if (lhs.which() == rhs.which()) {
244  const auto l = boost::get<ScalarTargetValue>(&lhs);
245  const auto r = boost::get<ScalarTargetValue>(&rhs);
246  if (l && r) {
247  return *l == *r;
248  }
249  const auto la = boost::get<ArrayTargetValue>(&lhs);
250  const auto ra = boost::get<ArrayTargetValue>(&rhs);
251  if (la && ra) {
252  if (la->is_initialized() && ra->is_initialized()) {
253  const auto& lvec = la->get();
254  const auto& rvec = ra->get();
255  return lvec == rvec;
256  }
257  if (!la->is_initialized() && !ra->is_initialized()) {
258  // NULL arrays: consider them equal
259  return true;
260  }
261  }
262  }
263  return false;
264 }
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the caller graph for this function:

◆ nullize_a_fixed_encoded_column()

template<typename T >
bool anonymous_namespace{UpdelStorageTest.cpp}::nullize_a_fixed_encoded_column ( const std::string &  table,
const std::string &  column,
const int64_t  cnt 
)

Definition at line 177 of file UpdelStorageTest.cpp.

References CHECK_EQ, and run_query().

179  {
180  update_common<int64_t>(
181  table, column, cnt, 1, inline_int_null_value<T>(), SQLTypeInfo());
182  std::string query_str =
183  "SELECT count(*) FROM " + table + " WHERE " + column + " IS NULL;";
184  auto rows = run_query(query_str);
185  auto crt_row = rows->getNextRow(true, true);
186  CHECK_EQ(size_t(1), crt_row.size());
187  auto r_cnt = v<int64_t>(crt_row[0]);
188  return r_cnt == cnt;
189 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
+ Here is the call graph for this function:

◆ prepare_table_for_delete()

bool anonymous_namespace{UpdelStorageTest.cpp}::prepare_table_for_delete ( const std::string &  table = "trips",
const std::string &  column = UpdelTestConfig::sequence,
const int64_t  cnt = UpdelTestConfig::fixNumRows 
)

Definition at line 380 of file UpdelStorageTest.cpp.

References UpdelRoll::commitUpdate(), compare_agg(), Data_Namespace::CPU_LEVEL, measure< TimeT >::execution(), QueryRunner::QueryRunner::get(), kBIGINT, Fragmenter_Namespace::InsertOrderFragmenter::updateColumn(), and VLOG.

Referenced by delete_and_immediately_vacuum_rows().

382  {
383  UpdelRoll updelRoll;
384  std::vector<uint64_t> fragOffsets;
385  std::vector<ScalarTargetValue> rhsValues;
386  for (int64_t i = 0; i < cnt; ++i) {
387  fragOffsets.push_back(i);
388  rhsValues.emplace_back(ScalarTargetValue(i));
389  }
390  auto ms = measure<>::execution([&]() {
392  QR::get()->getCatalog().get(),
393  table,
394  column,
395  0, // 1st frag since we have only 100 rows
396  fragOffsets,
397  rhsValues,
398  SQLTypeInfo(kBIGINT, false),
400  updelRoll);
401  });
402  if (UpdelTestConfig::showMeasuredTime) {
403  VLOG(2) << "time on update " << cnt << " rows:" << ms << " ms";
404  }
405  ms = measure<>::execution([&]() { updelRoll.commitUpdate(); });
406  if (UpdelTestConfig::showMeasuredTime) {
407  VLOG(2) << "time on commit:" << ms << " ms";
408  }
409  return compare_agg(table, column, cnt, (0 + cnt - 1) * cnt / 2. / cnt);
410 }
void commitUpdate()
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
static QueryRunner * get()
Definition: QueryRunner.h:115
bool compare_agg(const std::string &table, const std::string &column, const int64_t cnt, const double avg)
static void updateColumn(const Catalog_Namespace::Catalog *catalog, const std::string &tab_name, const std::string &col_name, const int fragment_id, const std::vector< uint64_t > &frag_offsets, const std::vector< ScalarTargetValue > &rhs_values, const SQLTypeInfo &rhs_type, const Data_Namespace::MemoryLevel memory_level, UpdelRoll &updel_roll)
static TimeT::rep execution(F func, Args &&... args)
Definition: sample.cpp:29
#define VLOG(n)
Definition: Logger.h:277
boost::variant< int64_t, double, float, NullableString > ScalarTargetValue
Definition: TargetValue.h:156
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run_ddl_statement()

void anonymous_namespace{UpdelStorageTest.cpp}::run_ddl_statement ( const std::string &  input_str)
inline

Definition at line 89 of file UpdelStorageTest.cpp.

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

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

◆ run_query()

std::shared_ptr<ResultSet> anonymous_namespace{UpdelStorageTest.cpp}::run_query ( const std::string &  query_str)

Definition at line 102 of file UpdelStorageTest.cpp.

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

Referenced by check_row_count_with_string(), compare_agg(), delete_and_vacuum_varlen_rows(), get_some_rows(), nullize_a_fixed_encoded_column(), TEST_F(), update_a_boolean_column(), update_a_encoded_string_column(), and update_column_from_decimal().

102  {
103  return QR::get()->runSQL(query_str, ExecutorDeviceType::CPU, true, true);
104 }
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:

◆ targetValue() [1/2]

template<typename T >
TargetValue anonymous_namespace{UpdelStorageTest.cpp}::targetValue ( std::true_type  ,
const std::vector< T > &  vals 
)

Definition at line 220 of file UpdelStorageTest.cpp.

220  {
221  return std::vector<ScalarTargetValue>(vals.begin(), vals.end());
222 }

◆ targetValue() [2/2]

template<typename T >
TargetValue anonymous_namespace{UpdelStorageTest.cpp}::targetValue ( std::false_type  ,
const T &  val 
)

Definition at line 225 of file UpdelStorageTest.cpp.

225  {
226  return ScalarTargetValue(val);
227 }
boost::variant< int64_t, double, float, NullableString > ScalarTargetValue
Definition: TargetValue.h:156

◆ TEST_F() [1/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTestWithVarlenAndArrays_0  ,
Vacuum_Half_Then_Add_All   
)

Definition at line 638 of file UpdelStorageTest.cpp.

References CHECK, CHECK_EQ, delete_and_vacuum_varlen_rows(), import_table_file(), run_query(), and to_string().

638  {
639  // delete and vacuum half of (8) rows
640  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
641  UpdelTestConfig::varNumRows,
642  UpdelTestConfig::varNumRows / 2,
643  0,
644  1,
645  true));
646 
647  // add ALL row back
648  EXPECT_NO_THROW(import_table_file("varlen", UpdelTestConfig::varFile););
649  // check new added rows ...
650  auto rows = run_query("select ns from varlen where rowid >= " +
651  std::to_string(UpdelTestConfig::varNumRows / 2) + ";");
652  for (int i = 0; i < UpdelTestConfig::varNumRows; ++i) {
653  auto crt_row = rows->getNextRow(true, true);
654  CHECK_EQ(size_t(1), crt_row.size());
655  auto nullable_str = v<NullableString>(crt_row[0]);
656  auto ns = boost::get<std::string>(&nullable_str);
657  CHECK(ns);
658  EXPECT_TRUE(*ns == std::to_string(i + 1));
659  }
660 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
std::string to_string(char const *&&v)
void import_table_file(const std::string &table, const std::string &file)
#define CHECK(condition)
Definition: Logger.h:187
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [2/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( ManualRowVacuumTestWithVarlenAndArrays  ,
Vacuum_Half_First   
)

Definition at line 664 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

664  {
665  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
666  UpdelTestConfig::varNumRows,
667  UpdelTestConfig::varNumRows / 2,
668  0,
669  1,
670  true));
671 }
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [3/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( ManualRowVacuumTestWithVarlenAndArrays  ,
Vacuum_Half_Second   
)

Definition at line 672 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

672  {
673  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
674  UpdelTestConfig::varNumRows,
675  UpdelTestConfig::varNumRows / 2,
676  UpdelTestConfig::varNumRows / 2,
677  1,
678  true));
679 }
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [4/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( ManualRowVacuumTestWithVarlenAndArrays  ,
Vacuum_Interleaved_2   
)

Definition at line 680 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

680  {
681  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
682  UpdelTestConfig::varNumRows,
683  UpdelTestConfig::varNumRows / 2,
684  0,
685  2,
686  true));
687 }
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [5/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( ManualRowVacuumTestWithVarlenAndArrays  ,
Vacuum_Interleaved_3   
)

Definition at line 688 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

688  {
689  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
690  UpdelTestConfig::varNumRows,
691  UpdelTestConfig::varNumRows / 3,
692  0,
693  3,
694  true));
695 }
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [6/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTestWithVarlenAndArrays  ,
Vacuum_Half_First   
)

Definition at line 699 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

699  {
700  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
701  UpdelTestConfig::varNumRows,
702  UpdelTestConfig::varNumRows / 2,
703  0,
704  1,
705  false));
706 }
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [7/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTestWithVarlenAndArrays  ,
Vacuum_Half_Second   
)

Definition at line 707 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

707  {
708  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
709  UpdelTestConfig::varNumRows,
710  UpdelTestConfig::varNumRows / 2,
711  UpdelTestConfig::varNumRows / 2,
712  1,
713  false));
714 }
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [8/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTestWithVarlenAndArrays  ,
Vacuum_Interleaved_2   
)

Definition at line 715 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

715  {
716  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
717  UpdelTestConfig::varNumRows,
718  UpdelTestConfig::varNumRows / 2,
719  0,
720  2,
721  false));
722 }
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [9/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTestWithVarlenAndArrays  ,
Vacuum_Interleaved_3   
)

Definition at line 723 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

723  {
724  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
725  UpdelTestConfig::varNumRows,
726  UpdelTestConfig::varNumRows / 3,
727  0,
728  3,
729  false));
730 }
bool delete_and_vacuum_varlen_rows(const std::string &table, const int nall, const int ndel, const int start, const int step, const bool manual_vacuum)
+ Here is the call graph for this function:

◆ TEST_F() [10/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTest  ,
Vacuum_Half_First   
)

Definition at line 745 of file UpdelStorageTest.cpp.

References delete_and_immediately_vacuum_rows().

745  {
746  EXPECT_TRUE(delete_and_immediately_vacuum_rows("trips",
747  UpdelTestConfig::sequence,
748  "deleted",
749  UpdelTestConfig::fixNumRows,
750  UpdelTestConfig::fixNumRows / 2,
751  0,
752  1));
753 }
bool delete_and_immediately_vacuum_rows(const std::string &table, const std::string &column, const std::string &deleted_column, const int64_t nall, const int dcnt, const int start, const int step)
+ Here is the call graph for this function:

◆ TEST_F() [11/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTest  ,
Vacuum_Half_Second   
)

Definition at line 754 of file UpdelStorageTest.cpp.

References delete_and_immediately_vacuum_rows().

754  {
755  EXPECT_TRUE(delete_and_immediately_vacuum_rows("trips",
756  UpdelTestConfig::sequence,
757  "deleted",
758  UpdelTestConfig::fixNumRows,
759  UpdelTestConfig::fixNumRows / 2,
760  UpdelTestConfig::fixNumRows / 2,
761  1));
762 }
bool delete_and_immediately_vacuum_rows(const std::string &table, const std::string &column, const std::string &deleted_column, const int64_t nall, const int dcnt, const int start, const int step)
+ Here is the call graph for this function:

◆ TEST_F() [12/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTest  ,
Vacuum_Interleaved_2   
)

Definition at line 763 of file UpdelStorageTest.cpp.

References delete_and_immediately_vacuum_rows().

763  {
764  EXPECT_TRUE(delete_and_immediately_vacuum_rows("trips",
765  UpdelTestConfig::sequence,
766  "deleted",
767  UpdelTestConfig::fixNumRows,
768  UpdelTestConfig::fixNumRows / 2,
769  0,
770  2));
771 }
bool delete_and_immediately_vacuum_rows(const std::string &table, const std::string &column, const std::string &deleted_column, const int64_t nall, const int dcnt, const int start, const int step)
+ Here is the call graph for this function:

◆ TEST_F() [13/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTest  ,
Vacuum_Interleaved_4   
)

Definition at line 772 of file UpdelStorageTest.cpp.

References delete_and_immediately_vacuum_rows(), init_table_data(), run_ddl_statement(), run_query(), TEST_F(), and update_a_numeric_column().

772  {
773  EXPECT_TRUE(delete_and_immediately_vacuum_rows("trips",
774  UpdelTestConfig::sequence,
775  "deleted",
776  UpdelTestConfig::fixNumRows,
777  UpdelTestConfig::fixNumRows / 4,
778  0,
779  4));
780 }
bool delete_and_immediately_vacuum_rows(const std::string &table, const std::string &column, const std::string &deleted_column, const int64_t nall, const int dcnt, const int start, const int step)
+ Here is the call graph for this function:

◆ TEST_F() [14/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_null_8   
)

Definition at line 815 of file UpdelStorageTest.cpp.

815  {
816  EXPECT_TRUE(nullize_a_fixed_encoded_column<int8_t>(
817  "trips", "rate_code_id", UpdelTestConfig::fixNumRows));
818 }

◆ TEST_F() [15/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_null_16   
)

Definition at line 819 of file UpdelStorageTest.cpp.

819  {
820  EXPECT_TRUE(nullize_a_fixed_encoded_column<int16_t>(
821  "trips", "rate_code_id", UpdelTestConfig::fixNumRows));
822 }

◆ TEST_F() [16/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_null_32_throw   
)

Definition at line 823 of file UpdelStorageTest.cpp.

823  {
824  EXPECT_THROW(nullize_a_fixed_encoded_column<int32_t>(
825  "trips", "rate_code_id", UpdelTestConfig::fixNumRows),
826  std::runtime_error);
827 }

◆ TEST_F() [17/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_null_64_throw   
)

Definition at line 828 of file UpdelStorageTest.cpp.

828  {
829  EXPECT_THROW(nullize_a_fixed_encoded_column<int64_t>(
830  "trips", "rate_code_id", UpdelTestConfig::fixNumRows),
831  std::runtime_error);
832 }

◆ TEST_F() [18/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_null_16   
)

Definition at line 834 of file UpdelStorageTest.cpp.

834  {
835  EXPECT_TRUE(nullize_a_fixed_encoded_column<int16_t>(
836  "trips", "passenger_count", UpdelTestConfig::fixNumRows));
837 }

◆ TEST_F() [19/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_null_32   
)

Definition at line 838 of file UpdelStorageTest.cpp.

838  {
839  EXPECT_TRUE(nullize_a_fixed_encoded_column<int32_t>(
840  "trips", "passenger_count", UpdelTestConfig::fixNumRows));
841 }

◆ TEST_F() [20/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_null_64_throw   
)

Definition at line 842 of file UpdelStorageTest.cpp.

842  {
843  EXPECT_THROW(nullize_a_fixed_encoded_column<int64_t>(
844  "trips", "passenger_count", UpdelTestConfig::fixNumRows),
845  std::runtime_error);
846 }

◆ TEST_F() [21/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_integer_trip_time_in_secs_null_32   
)

Definition at line 848 of file UpdelStorageTest.cpp.

848  {
849  EXPECT_TRUE(nullize_a_fixed_encoded_column<int32_t>(
850  "trips", "trip_time_in_secs", UpdelTestConfig::fixNumRows));
851 }

◆ TEST_F() [22/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_integer_trip_time_in_secs_null_64_throw   
)

Definition at line 852 of file UpdelStorageTest.cpp.

852  {
853  EXPECT_THROW(nullize_a_fixed_encoded_column<int64_t>(
854  "trips", "trip_time_in_secs", UpdelTestConfig::fixNumRows),
855  std::runtime_error);
856 }

◆ TEST_F() [23/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_throw   
)

Definition at line 858 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

858  {
859  EXPECT_TRUE(update_a_numeric_column(
860  "trips", "rate_code_id", UpdelTestConfig::fixNumRows, 1, 44 * 2, 44 * 2.0));
861  EXPECT_THROW(update_a_numeric_column(
862  "trips", "rate_code_id", UpdelTestConfig::fixNumRows, 1, +257, +257),
863  std::runtime_error);
864  EXPECT_THROW(update_a_numeric_column(
865  "trips", "rate_code_id", UpdelTestConfig::fixNumRows, 1, -256, -256),
866  std::runtime_error);
867 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [24/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_0_LHS_decimal_19_5   
)

Definition at line 870 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_latitude.

870  {
871  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
872  "dropoff_latitude",
873  UpdelTestConfig::fixNumRows,
874  1234506789,
875  SQLTypeInfo(kDECIMAL, 10, 0, false),
877  0));
878 }
#define SQLTypeInfo_dropoff_latitude
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823

◆ TEST_F() [25/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_2_LHS_decimal_19_5   
)

Definition at line 879 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_latitude.

879  {
880  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
881  "dropoff_latitude",
882  UpdelTestConfig::fixNumRows,
883  1234506789,
884  SQLTypeInfo(kDECIMAL, 10, 2, false),
886  0));
887 }
#define SQLTypeInfo_dropoff_latitude
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823

◆ TEST_F() [26/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_15_2_LHS_decimal_19_5   
)

Definition at line 888 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_latitude.

888  {
889  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
890  "dropoff_latitude",
891  UpdelTestConfig::fixNumRows,
892  123456789012345,
893  SQLTypeInfo(kDECIMAL, 15, 2, false),
895  0));
896 }
#define SQLTypeInfo_dropoff_latitude
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823

◆ TEST_F() [27/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_17_2_LHS_decimal_19_5_throw   
)

Definition at line 897 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_latitude.

897  {
898  EXPECT_THROW(update_column_from_decimal<int64_t>("trips",
899  "dropoff_latitude",
900  UpdelTestConfig::fixNumRows,
901  12345678901234567,
902  SQLTypeInfo(kDECIMAL, 17, 2, false),
904  0),
905  std::runtime_error);
906 }
#define SQLTypeInfo_dropoff_latitude
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823

◆ TEST_F() [28/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_0_LHS_double   
)

Definition at line 909 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_longitude.

909  {
910  EXPECT_TRUE(update_column_from_decimal<double>("trips",
911  "dropoff_longitude",
912  UpdelTestConfig::fixNumRows,
913  1234506789,
914  SQLTypeInfo(kDECIMAL, 10, 0, false),
916  1E-15));
917 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
#define SQLTypeInfo_dropoff_longitude

◆ TEST_F() [29/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_2_LHS_double   
)

Definition at line 918 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_longitude.

918  {
919  EXPECT_TRUE(update_column_from_decimal<double>("trips",
920  "dropoff_longitude",
921  UpdelTestConfig::fixNumRows,
922  1234506789,
923  SQLTypeInfo(kDECIMAL, 10, 2, false),
925  1E-15));
926 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
#define SQLTypeInfo_dropoff_longitude

◆ TEST_F() [30/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_15_2_LHS_double   
)

Definition at line 927 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_longitude.

927  {
928  EXPECT_TRUE(update_column_from_decimal<double>("trips",
929  "dropoff_longitude",
930  UpdelTestConfig::fixNumRows,
931  123456789012345,
932  SQLTypeInfo(kDECIMAL, 15, 2, false),
934  1E-15));
935 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
#define SQLTypeInfo_dropoff_longitude

◆ TEST_F() [31/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_0_LHS_integer   
)

Definition at line 938 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_trip_time_in_secs.

938  {
939  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
940  "trip_time_in_secs",
941  UpdelTestConfig::fixNumRows,
942  1234506789,
943  SQLTypeInfo(kDECIMAL, 10, 0, false),
945  1));
946 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
#define SQLTypeInfo_trip_time_in_secs

◆ TEST_F() [32/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_2_LHS_integer   
)

Definition at line 947 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_trip_time_in_secs.

947  {
948  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
949  "trip_time_in_secs",
950  UpdelTestConfig::fixNumRows,
951  1234506789,
952  SQLTypeInfo(kDECIMAL, 10, 2, false),
954  1));
955 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
#define SQLTypeInfo_trip_time_in_secs

◆ TEST_F() [33/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_15_5_LHS_integer   
)

Definition at line 956 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_trip_time_in_secs.

956  {
957  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
958  "trip_time_in_secs",
959  UpdelTestConfig::fixNumRows,
960  123456789012345,
961  SQLTypeInfo(kDECIMAL, 15, 5, false),
963  1));
964 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
#define SQLTypeInfo_trip_time_in_secs

◆ TEST_F() [34/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_x1_throw   
)

Definition at line 966 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

966  {
967  EXPECT_TRUE(update_a_numeric_column(
968  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 1, 4 * 2, 4 * 2.0));
969  EXPECT_THROW(
971  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 1, +65537, +65537),
972  std::runtime_error);
973  EXPECT_THROW(
975  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 1, -65536, -65536),
976  std::runtime_error);
977 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [35/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_x1_rollback   
)

Definition at line 978 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

978  {
979  EXPECT_TRUE(update_a_numeric_column(
980  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 1, 4 * 2, 4 * 1.0, false));
981 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [36/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_fixed_encoded_integer_passenger_count_x2   
)

Definition at line 983 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

983  {
984  EXPECT_TRUE(update_a_numeric_column(
985  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 2, 4 * 2, 4. * 1.5));
986 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [37/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_fixed_encoded_integer_passenger_count_x2_rollback   
)

Definition at line 987 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

987  {
988  EXPECT_TRUE(update_a_numeric_column("trips",
989  "passenger_count",
990  UpdelTestConfig::fixNumRows,
991  2,
992  4 * 2,
993  4. * 1.0,
994  false));
995 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [38/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_int_trip_time_in_secs_x2   
)

Definition at line 997 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

997  {
998  EXPECT_TRUE(update_a_numeric_column(
999  "trips", "trip_time_in_secs", UpdelTestConfig::fixNumRows, 1, 382 * 2, 382 * 2.0));
1000 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [39/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_int_trip_time_in_secs_x2_rollback   
)

Definition at line 1001 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1001  {
1002  EXPECT_TRUE(update_a_numeric_column("trips",
1003  "trip_time_in_secs",
1004  UpdelTestConfig::fixNumRows,
1005  1,
1006  382 * 2,
1007  382 * 1.0,
1008  false));
1009 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [40/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_int_trip_time_in_secs_x2   
)

Definition at line 1011 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1011  {
1012  EXPECT_TRUE(update_a_numeric_column(
1013  "trips", "trip_time_in_secs", UpdelTestConfig::fixNumRows, 2, 382 * 2, 382. * 1.5));
1014 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [41/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_int_trip_time_in_secs_x2_rollback   
)

Definition at line 1015 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1015  {
1016  EXPECT_TRUE(update_a_numeric_column("trips",
1017  "trip_time_in_secs",
1018  UpdelTestConfig::fixNumRows,
1019  2,
1020  382 * 2,
1021  382. * 1.0,
1022  false));
1023 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [42/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_float_trip_distance_x2   
)

Definition at line 1025 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1025  {
1026  EXPECT_TRUE(update_a_numeric_column(
1027  "trips", "trip_distance", UpdelTestConfig::fixNumRows, 1, 1 * 2, 1 * 2.0));
1028 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [43/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_float_trip_distance_x2_rollback   
)

Definition at line 1029 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1029  {
1030  EXPECT_TRUE(update_a_numeric_column(
1031  "trips", "trip_distance", UpdelTestConfig::fixNumRows, 1, 1 * 2, 1 * 1.0, false));
1032 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [44/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_float_trip_distance_x2   
)

Definition at line 1034 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1034  {
1035  EXPECT_TRUE(update_a_numeric_column(
1036  "trips", "trip_distance", UpdelTestConfig::fixNumRows, 2, 1 * 2, 1. * 1.5));
1037 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [45/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_float_trip_distance_x2_rollback   
)

Definition at line 1038 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1038  {
1039  EXPECT_TRUE(update_a_numeric_column(
1040  "trips", "trip_distance", UpdelTestConfig::fixNumRows, 2, 1 * 2, 1. * 1.0, false));
1041 }
bool update_a_numeric_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const double val, const double avg, const bool commit=true, const bool by_string=false)
+ Here is the call graph for this function:

◆ TEST_F() [46/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_string_vendor_id   
)

Definition at line 1043 of file UpdelStorageTest.cpp.

References update_a_encoded_string_column().

1043  {
1044  EXPECT_TRUE(update_a_encoded_string_column(
1045  "trips", "vendor_id", UpdelTestConfig::fixNumRows, 1, "abcxyz"));
1046 }
bool update_a_encoded_string_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const std::string &val, const bool commit=true)
+ Here is the call graph for this function:

◆ TEST_F() [47/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_string_vendor_id_rollback   
)

Definition at line 1047 of file UpdelStorageTest.cpp.

References update_a_encoded_string_column().

1047  {
1048  EXPECT_TRUE(update_a_encoded_string_column(
1049  "trips", "vendor_id", UpdelTestConfig::fixNumRows, 1, "abcxyz", false));
1050 }
bool update_a_encoded_string_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const std::string &val, const bool commit=true)
+ Here is the call graph for this function:

◆ TEST_F() [48/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_string_vendor_id   
)

Definition at line 1052 of file UpdelStorageTest.cpp.

References update_a_encoded_string_column().

1052  {
1053  EXPECT_TRUE(update_a_encoded_string_column(
1054  "trips", "vendor_id", UpdelTestConfig::fixNumRows, 2, "xyzabc"));
1055 }
bool update_a_encoded_string_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const std::string &val, const bool commit=true)
+ Here is the call graph for this function:

◆ TEST_F() [49/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_string_vendor_id_rollback   
)

Definition at line 1056 of file UpdelStorageTest.cpp.

References update_a_encoded_string_column().

1056  {
1057  EXPECT_TRUE(update_a_encoded_string_column(
1058  "trips", "vendor_id", UpdelTestConfig::fixNumRows, 2, "xyzabc", false));
1059 }
bool update_a_encoded_string_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const std::string &val, const bool commit=true)
+ Here is the call graph for this function:

◆ TEST_F() [50/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_boolean_deleted   
)

Definition at line 1061 of file UpdelStorageTest.cpp.

References update_a_boolean_column().

1061  {
1062  EXPECT_TRUE(
1063  update_a_boolean_column("trips", "deleted", UpdelTestConfig::fixNumRows, 1, true));
1064 }
bool update_a_boolean_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const bool val, const bool commit=true)
+ Here is the call graph for this function:

◆ TEST_F() [51/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_boolean_deleted_rollback   
)

Definition at line 1065 of file UpdelStorageTest.cpp.

References update_a_boolean_column().

1065  {
1066  EXPECT_TRUE(update_a_boolean_column(
1067  "trips", "deleted", UpdelTestConfig::fixNumRows, 1, true, false));
1068 }
bool update_a_boolean_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const bool val, const bool commit=true)
+ Here is the call graph for this function:

◆ TEST_F() [52/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_boolean_deleted   
)

Definition at line 1070 of file UpdelStorageTest.cpp.

References update_a_boolean_column().

1070  {
1071  EXPECT_TRUE(
1072  update_a_boolean_column("trips", "deleted", UpdelTestConfig::fixNumRows, 2, true));
1073 }
bool update_a_boolean_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const bool val, const bool commit=true)
+ Here is the call graph for this function:

◆ TEST_F() [53/53]

anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
Half_boolean_deleted_rollback   
)

Definition at line 1074 of file UpdelStorageTest.cpp.

References update_a_boolean_column().

Referenced by TEST_F().

1074  {
1075  EXPECT_TRUE(update_a_boolean_column(
1076  "trips", "deleted", UpdelTestConfig::fixNumRows, 2, true, false));
1077 }
bool update_a_boolean_column(const std::string &table, const std::string &column, const int64_t cnt, const int step, const bool val, const bool commit=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_a_boolean_column()

bool anonymous_namespace{UpdelStorageTest.cpp}::update_a_boolean_column ( const std::string &  table,
const std::string &  column,
const int64_t  cnt,
const int  step,
const bool  val,
const bool  commit = true 
)

Definition at line 310 of file UpdelStorageTest.cpp.

References CHECK_EQ, and run_query().

Referenced by TEST_F().

315  {
316  update_common<const std::string>(
317  table, column, cnt, step, val ? "T" : "F", SQLTypeInfo(), commit);
318  // count updated bools
319  std::string query_str =
320  "SELECT count(*) FROM " + table + " WHERE " + (val ? "" : " NOT ") + column + ";";
321  auto rows = run_query(query_str);
322  auto crt_row = rows->getNextRow(true, true);
323  CHECK_EQ(size_t(1), crt_row.size());
324  auto r_cnt = v<int64_t>(crt_row[0]);
325  return r_cnt == (commit ? cnt / step : 0);
326 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_a_encoded_string_column()

bool anonymous_namespace{UpdelStorageTest.cpp}::update_a_encoded_string_column ( const std::string &  table,
const std::string &  column,
const int64_t  cnt,
const int  step,
const std::string &  val,
const bool  commit = true 
)

Definition at line 291 of file UpdelStorageTest.cpp.

References CHECK_EQ, and run_query().

Referenced by TEST_F().

296  {
297  update_common<const std::string>(table, column, cnt, step, val, SQLTypeInfo(), commit);
298  // count updated string
299  std::string query_str =
300  "SELECT count(*) FROM " + table + " WHERE " + column + " = '" + val + "';";
301  auto rows = run_query(query_str);
302  auto crt_row = rows->getNextRow(true, true);
303  CHECK_EQ(size_t(1), crt_row.size());
304  auto r_cnt = v<int64_t>(crt_row[0]);
305  return r_cnt == (commit ? cnt / step : 0);
306 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_a_numeric_column()

bool anonymous_namespace{UpdelStorageTest.cpp}::update_a_numeric_column ( const std::string &  table,
const std::string &  column,
const int64_t  cnt,
const int  step,
const double  val,
const double  avg,
const bool  commit = true,
const bool  by_string = false 
)

Definition at line 159 of file UpdelStorageTest.cpp.

References compare_agg(), and to_string().

Referenced by TEST_F().

166  {
167  if (by_string) {
168  update_common<std::string>(
169  table, column, cnt, step, std::to_string(val), SQLTypeInfo(), commit);
170  } else {
171  update_common<double>(table, column, cnt, step, val, SQLTypeInfo(), commit);
172  }
173  return compare_agg(table, column, cnt, avg);
174 }
std::string to_string(char const *&&v)
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
bool compare_agg(const std::string &table, const std::string &column, const int64_t cnt, const double avg)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_column_from_decimal()

template<typename T >
bool anonymous_namespace{UpdelStorageTest.cpp}::update_column_from_decimal ( const std::string &  table,
const std::string &  column,
const int64_t  cnt,
const int64_t  rhsDecimal,
const SQLTypeInfo rhsType,
const SQLTypeInfo lhsType,
const double  max_loss,
const bool  commit = true 
)

Definition at line 329 of file UpdelStorageTest.cpp.

References CHECK_EQ, convert_decimal_value_to_scale(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_decimal(), run_query(), and VLOG.

336  {
337  update_common<int64_t>(table, column, cnt, 1, rhsDecimal, rhsType, commit);
338  std::string query_str = "SELECT DISTINCT " + column + " FROM " + table + ";";
339  auto rows = run_query(query_str);
340  CHECK_EQ(size_t(1), rows->rowCount());
341  auto crt_row = rows->getNextRow(true, false); // no decimal_to_double convert
342  auto l_decimal = v<T>(crt_row[0]);
343  int64_t r_decimal = rhsDecimal;
344 
345  if (lhsType.is_decimal()) {
346  l_decimal = convert_decimal_value_to_scale(l_decimal, lhsType, rhsType);
347  } else {
348  l_decimal *= pow(10, rhsType.get_scale());
349  }
350 
351  auto r_loss = std::abs(l_decimal - r_decimal) / r_decimal;
352  if (!(r_loss <= max_loss)) {
353  VLOG(1) << "l_decimal: " << l_decimal << ", r_decimal: " << r_decimal
354  << ", r_loss: " << r_loss << ", max_loss: " << max_loss;
355  }
356  return r_loss <= max_loss;
357 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
bool is_decimal() const
Definition: sqltypes.h:453
int64_t convert_decimal_value_to_scale(const int64_t decimal_value, const SQLTypeInfo &type_info, const SQLTypeInfo &new_type_info)
Definition: Datum.cpp:284
#define VLOG(n)
Definition: Logger.h:277
+ Here is the call graph for this function:

◆ update_common()

template<typename T >
void anonymous_namespace{UpdelStorageTest.cpp}::update_common ( const std::string &  table,
const std::string &  column,
const int64_t  cnt,
const int  step,
const T &  val,
const SQLTypeInfo rhsType,
const bool  commit = true 
)

Definition at line 133 of file UpdelStorageTest.cpp.

References UpdelRoll::commitUpdate(), Data_Namespace::CPU_LEVEL, QueryRunner::QueryRunner::get(), and Fragmenter_Namespace::InsertOrderFragmenter::updateColumn().

139  {
140  UpdelRoll updelRoll;
141  std::vector<uint64_t> fragOffsets;
142  std::vector<ScalarTargetValue> rhsValues;
143  update_prepare_offsets_values<T>(cnt, step, val, fragOffsets, rhsValues);
145  QR::get()->getCatalog().get(),
146  table,
147  column,
148  0, // 1st frag since we have only 100 rows
149  fragOffsets,
150  rhsValues,
151  rhsType,
153  updelRoll);
154  if (commit) {
155  updelRoll.commitUpdate();
156  }
157 }
void commitUpdate()
static QueryRunner * get()
Definition: QueryRunner.h:115
static void updateColumn(const Catalog_Namespace::Catalog *catalog, const std::string &tab_name, const std::string &col_name, const int fragment_id, const std::vector< uint64_t > &frag_offsets, const std::vector< ScalarTargetValue > &rhs_values, const SQLTypeInfo &rhs_type, const Data_Namespace::MemoryLevel memory_level, UpdelRoll &updel_roll)
+ Here is the call graph for this function:

◆ update_prepare_offsets_values()

template<typename T >
void anonymous_namespace{UpdelStorageTest.cpp}::update_prepare_offsets_values ( const int64_t  cnt,
const int  step,
const T  val,
std::vector< uint64_t > &  fragOffsets,
std::vector< ScalarTargetValue > &  rhsValues 
)

Definition at line 121 of file UpdelStorageTest.cpp.

125  {
126  for (int64_t i = 0; i < cnt; i += step) {
127  fragOffsets.push_back(i);
128  }
129  rhsValues.push_back(ScalarTargetValue(val));
130 }
boost::variant< int64_t, double, float, NullableString > ScalarTargetValue
Definition: TargetValue.h:156

◆ v()

template<class T >
T anonymous_namespace{UpdelStorageTest.cpp}::v ( const TargetValue r)

Definition at line 94 of file UpdelStorageTest.cpp.

References CHECK.

94  {
95  auto scalar_r = boost::get<ScalarTargetValue>(&r);
96  CHECK(scalar_r);
97  auto p = boost::get<T>(scalar_r);
98  CHECK(p);
99  return *p;
100 }
#define CHECK(condition)
Definition: Logger.h:187

Variable Documentation

◆ create_table_trips

const std::string anonymous_namespace{UpdelStorageTest.cpp}::create_table_trips
Initial value:
=
" CREATE TABLE trips ("
" medallion TEXT ENCODING DICT,"
" hack_license TEXT ENCODING DICT,"
" vendor_id TEXT ENCODING DICT,"
" rate_code_id SMALLINT ENCODING FIXED(8),"
" store_and_fwd_flag TEXT ENCODING DICT,"
" pickup_datetime TIMESTAMP,"
" dropoff_datetime TIMESTAMP,"
" passenger_count INTEGER ENCODING FIXED(16),"
" trip_time_in_secs INTEGER,"
" trip_distance FLOAT,"
" pickup_longitude DECIMAL(14,7),"
" pickup_latitude DECIMAL(14,7),"
" dropoff_longitude DOUBLE,"
" dropoff_latitude DECIMAL(18,5),"
" deleted BOOLEAN"
" )"

Definition at line 582 of file UpdelStorageTest.cpp.

◆ create_varlen_table1

const std::string anonymous_namespace{UpdelStorageTest.cpp}::create_varlen_table1
Initial value:
=
"CREATE TABLE varlen("
"ti tinyint,"
"si smallint,"
"ii int,"
"bi bigint,"
"ff float,"
"fd double,"
"de decimal(5,2),"
"ts timestamp,"
"ns text encoding none,"
"es text encoding dict(16),"
"faii int[2],"
"fadc decimal(5,2)[2],"
"fatx text[2],"

Definition at line 548 of file UpdelStorageTest.cpp.

◆ create_varlen_table2

const std::string anonymous_namespace{UpdelStorageTest.cpp}::create_varlen_table2
Initial value:
=
"pt point,"
"ls linestring,"
"pg polygon,"
"mp multipolygon,"

Definition at line 565 of file UpdelStorageTest.cpp.

Referenced by anonymous_namespace{UpdelStorageTest.cpp}::RowVacuumTestWithVarlenAndArraysN< N >::SetUp().

◆ create_varlen_table3

const std::string anonymous_namespace{UpdelStorageTest.cpp}::create_varlen_table3
Initial value:
=
"ati tinyint[],"
"asi smallint[],"
"aii int[],"
"abi bigint[],"
"aff float[],"
"afd double[],"
"adc decimal(5,2)[],"
"atx text[],"
"ats timestamp[]"
")"

Definition at line 570 of file UpdelStorageTest.cpp.

◆ fixNumRowsByDefault

constexpr int anonymous_namespace{UpdelStorageTest.cpp}::fixNumRowsByDefault = 100
static

Definition at line 60 of file UpdelStorageTest.cpp.

◆ varNumRowsByDefault

constexpr int anonymous_namespace{UpdelStorageTest.cpp}::varNumRowsByDefault = 8
static

Definition at line 59 of file UpdelStorageTest.cpp.