OmniSciDB  343343d194
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{UpdelStorageTest.cpp} Namespace Reference

Classes

struct  UpdelTestConfig
 
struct  ScalarTargetValueExtractor
 
class  RowVacuumTestWithVarlenAndArraysN
 
class  RowVacuumTest
 
class  UpdateStorageTest
 

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

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

Definition at line 664 of file UpdelStorageTest.cpp.

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

Definition at line 192 of file UpdelStorageTest.cpp.

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

Definition at line 193 of file UpdelStorageTest.cpp.

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

Definition at line 699 of file UpdelStorageTest.cpp.

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

Definition at line 638 of file UpdelStorageTest.cpp.

Function Documentation

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 413 of file UpdelStorageTest.cpp.

References CHECK_EQ, anonymous_namespace{AlterColumnTest.cpp}::run_query(), to_string(), and VLOG.

Referenced by delete_and_immediately_vacuum_rows().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 107 of file UpdelStorageTest.cpp.

References CHECK_EQ, and anonymous_namespace{AlterColumnTest.cpp}::run_query().

110  {
111  std::string query_str = "SELECT COUNT(*), AVG(" + column + ") FROM " + table + ";";
112  auto rows = run_query(query_str);
113  auto crt_row = rows->getNextRow(true, true);
114  CHECK_EQ(size_t(2), crt_row.size());
115  auto r_cnt = v<int64_t>(crt_row[0]);
116  auto r_avg = v<double>(crt_row[1]);
117  // VLOG(1) << "r_avg: " << std::to_string(r_avg) << ", avg: " << std::to_string(avg);
118  return r_cnt == cnt && std::abs(r_avg - avg) < 1E-6;
119 }
#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:

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 267 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().

272  {
273  const auto cat = QR::get()->getCatalog();
274  const auto td = cat->getMetadataForTable(table);
275  const auto cdl = cat->getAllColumnMetadataForTable(td->tableId, false, false, false);
276  const auto cds = std::vector<const ColumnDescriptor*>(cdl.begin(), cdl.end());
277  const auto noldc = oldr.size();
278  const auto nnewc = newr.size();
279  const auto is_geophy_included = cds.size() < noldc;
280  CHECK_EQ(noldc, nnewc);
281  for (std::remove_const<decltype(noldc)>::type i = 0, c = 0; c < noldc;
282  c += is_geophy_included ? cds[i]->columnType.get_physical_cols() + 1 : 1, ++i) {
283  if (!is_equal(newr[c], (commit && cds[i]->columnName == column ? val : oldr[c]))) {
284  VLOG(1) << cds[i]->columnName << ": " << dumpv(newr[c]) << " - "
285  << dumpv((commit && cds[i]->columnName == column ? val : oldr[c]));
286  return false;
287  }
288  }
289  return true;
290 }
#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)
static QueryRunner * get()
Definition: QueryRunner.h:118
std::shared_ptr< Catalog_Namespace::Catalog > getCatalog() const
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:

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 430 of file UpdelStorageTest.cpp.

References check_row_count_with_string(), UpdelRoll::commitUpdate(), anonymous_namespace{ImportTest.cpp}::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().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 488 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(), anonymous_namespace{AlterColumnTest.cpp}::run_query(), to_string(), TableOptimizer::vacuumDeletedRows(), and VLOG.

Referenced by TEST_F().

493  {
494  const auto old_rows = get_some_rows(table, nall);
495 
496  std::vector<uint64_t> fragOffsets;
497  for (int d = 0, i = start; d < ndel && i < nall; ++d, i += step) {
498  fragOffsets.push_back(i);
499  }
500 
501  // delete and vacuum rows
502  auto cond = std::string("rowid >= ") + std::to_string(start) + " and mod(rowid-" +
503  std::to_string(start) + "," + std::to_string(step) + ")=0 and rowid < " +
504  std::to_string(start) + "+" + std::to_string(step) + "*" +
505  std::to_string(ndel);
506  auto ms = measure<>::execution([&]() {
507  ASSERT_NO_THROW(run_query("delete from " + table + " where " + cond + ";"););
508  });
509  if (UpdelTestConfig::showMeasuredTime) {
510  VLOG(2) << "time on delete " << (manual_vacuum ? "" : "& vacuum ")
511  << fragOffsets.size() << " rows:" << ms << " ms";
512  }
513 
514  if (manual_vacuum) {
515  ms = measure<>::execution([&]() {
516  auto cat = QR::get()->getCatalog().get();
517  const auto td = cat->getMetadataForTable(table,
518  /*populateFragmenter=*/true);
519  auto executor = Executor::getExecutor(cat->getCurrentDB().dbId);
520  TableOptimizer optimizer(td, executor.get(), *cat);
521  optimizer.vacuumDeletedRows();
522  optimizer.recomputeMetadata();
523  });
524  if (UpdelTestConfig::showMeasuredTime) {
525  VLOG(2) << "time on vacuum:" << ms << " ms";
526  }
527  }
528 
529  const auto new_rows = get_some_rows(table, nall);
530  if (!UpdelTestConfig::enableVarUpdelPerfTest) {
531  for (int oi = 0, ni = 0; oi < nall; ++oi) {
532  if (fragOffsets.end() == std::find(fragOffsets.begin(), fragOffsets.end(), oi)) {
533  if (!compare_row(table,
534  "",
535  old_rows[oi],
536  new_rows[ni++],
537  ScalarTargetValue(int64_t{1}),
538  false)) {
539  return false;
540  }
541  }
542  }
543  }
544  return true;
545 }
void d(const SQLTypes expected_type, const std::string &str)
Definition: ImportTest.cpp:289
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:123
static TimeT::rep execution(F func, Args &&...args)
Definition: sample.cpp:29
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)
void vacuumDeletedRows() const
Compacts fragments to remove deleted rows. When a row is deleted, a boolean deleted system column is ...
static QueryRunner * get()
Definition: QueryRunner.h:118
std::shared_ptr< ResultSet > run_query(const std::string &query_str)
bool compare_row(const std::string &table, const std::string &column, const ResultRow &oldr, const ResultRow &newr, const TargetValue &val, const bool commit)
std::shared_ptr< Catalog_Namespace::Catalog > getCatalog() const
#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:

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

Definition at line 230 of file UpdelStorageTest.cpp.

References join().

Referenced by compare_row().

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

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

Definition at line 195 of file UpdelStorageTest.cpp.

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

Referenced by delete_and_vacuum_varlen_rows().

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

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

Definition at line 360 of file UpdelStorageTest.cpp.

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

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

+ Here is the call graph for this function:

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 602 of file UpdelStorageTest.cpp.

References measure< TimeT >::execution(), anonymous_namespace{AlterColumnTest.cpp}::import_table_file(), run_ddl_statement(), and VLOG.

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

+ Here is the call graph for this function:

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

Definition at line 242 of file UpdelStorageTest.cpp.

References CHECK.

Referenced by compare_row().

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

+ Here is the caller graph for this function:

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 178 of file UpdelStorageTest.cpp.

References CHECK_EQ, and anonymous_namespace{AlterColumnTest.cpp}::run_query().

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

+ Here is the call graph for this function:

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 381 of file UpdelStorageTest.cpp.

References UpdelRoll::commitUpdate(), anonymous_namespace{ImportTest.cpp}::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().

383  {
384  UpdelRoll updelRoll;
385  std::vector<uint64_t> fragOffsets;
386  std::vector<ScalarTargetValue> rhsValues;
387  for (int64_t i = 0; i < cnt; ++i) {
388  fragOffsets.push_back(i);
389  rhsValues.emplace_back(ScalarTargetValue(i));
390  }
391  auto ms = measure<>::execution([&]() {
393  QR::get()->getCatalog().get(),
394  table,
395  column,
396  0, // 1st frag since we have only 100 rows
397  fragOffsets,
398  rhsValues,
399  SQLTypeInfo(kBIGINT, false),
401  updelRoll);
402  });
403  if (UpdelTestConfig::showMeasuredTime) {
404  VLOG(2) << "time on update " << cnt << " rows:" << ms << " ms";
405  }
406  ms = measure<>::execution([&]() { updelRoll.commitUpdate(); });
407  if (UpdelTestConfig::showMeasuredTime) {
408  VLOG(2) << "time on commit:" << ms << " ms";
409  }
410  return compare_agg(table, column, cnt, (0 + cnt - 1) * cnt / 2. / cnt);
411 }
void commitUpdate()
static TimeT::rep execution(F func, Args &&...args)
Definition: sample.cpp:29
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
static QueryRunner * get()
Definition: QueryRunner.h:118
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)
bool compare_agg(const int64_t cnt, const double avg)
Definition: ImportTest.cpp:71
#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:

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

Definition at line 90 of file UpdelStorageTest.cpp.

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

90  {
91  QR::get()->runDDLStatement(input_str);
92 }
virtual void runDDLStatement(const std::string &)
static QueryRunner * get()
Definition: QueryRunner.h:118

+ Here is the call graph for this function:

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

Definition at line 103 of file UpdelStorageTest.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 221 of file UpdelStorageTest.cpp.

221  {
222  return std::vector<ScalarTargetValue>(vals.begin(), vals.end());
223 }
template<typename T >
TargetValue anonymous_namespace{UpdelStorageTest.cpp}::targetValue ( std::false_type  ,
const T &  val 
)

Definition at line 226 of file UpdelStorageTest.cpp.

226  {
227  return ScalarTargetValue(val);
228 }
boost::variant< int64_t, double, float, NullableString > ScalarTargetValue
Definition: TargetValue.h:156
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( RowVacuumTestWithVarlenAndArrays_0  ,
Vacuum_Half_Then_Add_All   
)

Definition at line 639 of file UpdelStorageTest.cpp.

References CHECK, CHECK_EQ, delete_and_vacuum_varlen_rows(), anonymous_namespace{AlterColumnTest.cpp}::import_table_file(), anonymous_namespace{AlterColumnTest.cpp}::run_query(), and to_string().

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

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

Definition at line 665 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

665  {
666  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
667  UpdelTestConfig::varNumRows,
668  UpdelTestConfig::varNumRows / 2,
669  0,
670  1,
671  true));
672 }
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:

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

Definition at line 673 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

673  {
674  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
675  UpdelTestConfig::varNumRows,
676  UpdelTestConfig::varNumRows / 2,
677  UpdelTestConfig::varNumRows / 2,
678  1,
679  true));
680 }
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:

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

Definition at line 681 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

681  {
682  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
683  UpdelTestConfig::varNumRows,
684  UpdelTestConfig::varNumRows / 2,
685  0,
686  2,
687  true));
688 }
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:

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

Definition at line 689 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

689  {
690  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
691  UpdelTestConfig::varNumRows,
692  UpdelTestConfig::varNumRows / 3,
693  0,
694  3,
695  true));
696 }
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:

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

Definition at line 700 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

700  {
701  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
702  UpdelTestConfig::varNumRows,
703  UpdelTestConfig::varNumRows / 2,
704  0,
705  1,
706  false));
707 }
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:

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

Definition at line 708 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

708  {
709  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
710  UpdelTestConfig::varNumRows,
711  UpdelTestConfig::varNumRows / 2,
712  UpdelTestConfig::varNumRows / 2,
713  1,
714  false));
715 }
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:

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

Definition at line 716 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

716  {
717  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
718  UpdelTestConfig::varNumRows,
719  UpdelTestConfig::varNumRows / 2,
720  0,
721  2,
722  false));
723 }
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:

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

Definition at line 724 of file UpdelStorageTest.cpp.

References delete_and_vacuum_varlen_rows().

724  {
725  EXPECT_TRUE(delete_and_vacuum_varlen_rows("varlen",
726  UpdelTestConfig::varNumRows,
727  UpdelTestConfig::varNumRows / 3,
728  0,
729  3,
730  false));
731 }
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:

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

Definition at line 746 of file UpdelStorageTest.cpp.

References delete_and_immediately_vacuum_rows().

746  {
747  EXPECT_TRUE(delete_and_immediately_vacuum_rows("trips",
748  UpdelTestConfig::sequence,
749  "deleted",
750  UpdelTestConfig::fixNumRows,
751  UpdelTestConfig::fixNumRows / 2,
752  0,
753  1));
754 }
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:

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

Definition at line 755 of file UpdelStorageTest.cpp.

References delete_and_immediately_vacuum_rows().

755  {
756  EXPECT_TRUE(delete_and_immediately_vacuum_rows("trips",
757  UpdelTestConfig::sequence,
758  "deleted",
759  UpdelTestConfig::fixNumRows,
760  UpdelTestConfig::fixNumRows / 2,
761  UpdelTestConfig::fixNumRows / 2,
762  1));
763 }
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:

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

Definition at line 764 of file UpdelStorageTest.cpp.

References delete_and_immediately_vacuum_rows().

764  {
765  EXPECT_TRUE(delete_and_immediately_vacuum_rows("trips",
766  UpdelTestConfig::sequence,
767  "deleted",
768  UpdelTestConfig::fixNumRows,
769  UpdelTestConfig::fixNumRows / 2,
770  0,
771  2));
772 }
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:

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

Definition at line 773 of file UpdelStorageTest.cpp.

References delete_and_immediately_vacuum_rows().

773  {
774  EXPECT_TRUE(delete_and_immediately_vacuum_rows("trips",
775  UpdelTestConfig::sequence,
776  "deleted",
777  UpdelTestConfig::fixNumRows,
778  UpdelTestConfig::fixNumRows / 4,
779  0,
780  4));
781 }
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:

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

Definition at line 816 of file UpdelStorageTest.cpp.

816  {
817  EXPECT_TRUE(nullize_a_fixed_encoded_column<int8_t>(
818  "trips", "rate_code_id", UpdelTestConfig::fixNumRows));
819 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_null_16   
)

Definition at line 820 of file UpdelStorageTest.cpp.

820  {
821  EXPECT_TRUE(nullize_a_fixed_encoded_column<int16_t>(
822  "trips", "rate_code_id", UpdelTestConfig::fixNumRows));
823 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_null_32_throw   
)

Definition at line 824 of file UpdelStorageTest.cpp.

824  {
825  EXPECT_THROW(nullize_a_fixed_encoded_column<int32_t>(
826  "trips", "rate_code_id", UpdelTestConfig::fixNumRows),
827  std::runtime_error);
828 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_null_64_throw   
)

Definition at line 829 of file UpdelStorageTest.cpp.

829  {
830  EXPECT_THROW(nullize_a_fixed_encoded_column<int64_t>(
831  "trips", "rate_code_id", UpdelTestConfig::fixNumRows),
832  std::runtime_error);
833 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_null_16   
)

Definition at line 835 of file UpdelStorageTest.cpp.

835  {
836  EXPECT_TRUE(nullize_a_fixed_encoded_column<int16_t>(
837  "trips", "passenger_count", UpdelTestConfig::fixNumRows));
838 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_null_32   
)

Definition at line 839 of file UpdelStorageTest.cpp.

839  {
840  EXPECT_TRUE(nullize_a_fixed_encoded_column<int32_t>(
841  "trips", "passenger_count", UpdelTestConfig::fixNumRows));
842 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_null_64_throw   
)

Definition at line 843 of file UpdelStorageTest.cpp.

843  {
844  EXPECT_THROW(nullize_a_fixed_encoded_column<int64_t>(
845  "trips", "passenger_count", UpdelTestConfig::fixNumRows),
846  std::runtime_error);
847 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_integer_trip_time_in_secs_null_32   
)

Definition at line 849 of file UpdelStorageTest.cpp.

849  {
850  EXPECT_TRUE(nullize_a_fixed_encoded_column<int32_t>(
851  "trips", "trip_time_in_secs", UpdelTestConfig::fixNumRows));
852 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_integer_trip_time_in_secs_null_64_throw   
)

Definition at line 853 of file UpdelStorageTest.cpp.

853  {
854  EXPECT_THROW(nullize_a_fixed_encoded_column<int64_t>(
855  "trips", "trip_time_in_secs", UpdelTestConfig::fixNumRows),
856  std::runtime_error);
857 }
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_smallint_rate_code_id_throw   
)

Definition at line 859 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

859  {
860  EXPECT_TRUE(update_a_numeric_column(
861  "trips", "rate_code_id", UpdelTestConfig::fixNumRows, 1, 44 * 2, 44 * 2.0));
862  EXPECT_THROW(update_a_numeric_column(
863  "trips", "rate_code_id", UpdelTestConfig::fixNumRows, 1, +257, +257),
864  std::runtime_error);
865  EXPECT_THROW(update_a_numeric_column(
866  "trips", "rate_code_id", UpdelTestConfig::fixNumRows, 1, -256, -256),
867  std::runtime_error);
868 }
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:

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

Definition at line 871 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_latitude.

871  {
872  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
873  "dropoff_latitude",
874  UpdelTestConfig::fixNumRows,
875  1234506789,
876  SQLTypeInfo(kDECIMAL, 10, 0, false),
878  0));
879 }
#define SQLTypeInfo_dropoff_latitude
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_2_LHS_decimal_19_5   
)

Definition at line 880 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_latitude.

880  {
881  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
882  "dropoff_latitude",
883  UpdelTestConfig::fixNumRows,
884  1234506789,
885  SQLTypeInfo(kDECIMAL, 10, 2, false),
887  0));
888 }
#define SQLTypeInfo_dropoff_latitude
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_15_2_LHS_decimal_19_5   
)

Definition at line 889 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_latitude.

889  {
890  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
891  "dropoff_latitude",
892  UpdelTestConfig::fixNumRows,
893  123456789012345,
894  SQLTypeInfo(kDECIMAL, 15, 2, false),
896  0));
897 }
#define SQLTypeInfo_dropoff_latitude
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_17_2_LHS_decimal_19_5_throw   
)

Definition at line 898 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_latitude.

898  {
899  EXPECT_THROW(update_column_from_decimal<int64_t>("trips",
900  "dropoff_latitude",
901  UpdelTestConfig::fixNumRows,
902  12345678901234567,
903  SQLTypeInfo(kDECIMAL, 17, 2, false),
905  0),
906  std::runtime_error);
907 }
#define SQLTypeInfo_dropoff_latitude
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_0_LHS_double   
)

Definition at line 910 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_longitude.

910  {
911  EXPECT_TRUE(update_column_from_decimal<double>("trips",
912  "dropoff_longitude",
913  UpdelTestConfig::fixNumRows,
914  1234506789,
915  SQLTypeInfo(kDECIMAL, 10, 0, false),
917  1E-15));
918 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
#define SQLTypeInfo_dropoff_longitude
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_2_LHS_double   
)

Definition at line 919 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_longitude.

919  {
920  EXPECT_TRUE(update_column_from_decimal<double>("trips",
921  "dropoff_longitude",
922  UpdelTestConfig::fixNumRows,
923  1234506789,
924  SQLTypeInfo(kDECIMAL, 10, 2, false),
926  1E-15));
927 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
#define SQLTypeInfo_dropoff_longitude
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_15_2_LHS_double   
)

Definition at line 928 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_dropoff_longitude.

928  {
929  EXPECT_TRUE(update_column_from_decimal<double>("trips",
930  "dropoff_longitude",
931  UpdelTestConfig::fixNumRows,
932  123456789012345,
933  SQLTypeInfo(kDECIMAL, 15, 2, false),
935  1E-15));
936 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
#define SQLTypeInfo_dropoff_longitude
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_0_LHS_integer   
)

Definition at line 939 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_trip_time_in_secs.

939  {
940  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
941  "trip_time_in_secs",
942  UpdelTestConfig::fixNumRows,
943  1234506789,
944  SQLTypeInfo(kDECIMAL, 10, 0, false),
946  1));
947 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
#define SQLTypeInfo_trip_time_in_secs
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_10_2_LHS_integer   
)

Definition at line 948 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_trip_time_in_secs.

948  {
949  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
950  "trip_time_in_secs",
951  UpdelTestConfig::fixNumRows,
952  1234506789,
953  SQLTypeInfo(kDECIMAL, 10, 2, false),
955  1));
956 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
#define SQLTypeInfo_trip_time_in_secs
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_RHS_decimal_15_5_LHS_integer   
)

Definition at line 957 of file UpdelStorageTest.cpp.

References kDECIMAL, and SQLTypeInfo_trip_time_in_secs.

957  {
958  EXPECT_TRUE(update_column_from_decimal<int64_t>("trips",
959  "trip_time_in_secs",
960  UpdelTestConfig::fixNumRows,
961  123456789012345,
962  SQLTypeInfo(kDECIMAL, 15, 5, false),
964  1));
965 }
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
#define SQLTypeInfo_trip_time_in_secs
anonymous_namespace{UpdelStorageTest.cpp}::TEST_F ( UpdateStorageTest  ,
All_fixed_encoded_integer_passenger_count_x1_throw   
)

Definition at line 967 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

967  {
968  EXPECT_TRUE(update_a_numeric_column(
969  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 1, 4 * 2, 4 * 2.0));
970  EXPECT_THROW(
972  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 1, +65537, +65537),
973  std::runtime_error);
974  EXPECT_THROW(
976  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 1, -65536, -65536),
977  std::runtime_error);
978 }
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:

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

Definition at line 979 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

979  {
980  EXPECT_TRUE(update_a_numeric_column(
981  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 1, 4 * 2, 4 * 1.0, false));
982 }
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:

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

Definition at line 984 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

984  {
985  EXPECT_TRUE(update_a_numeric_column(
986  "trips", "passenger_count", UpdelTestConfig::fixNumRows, 2, 4 * 2, 4. * 1.5));
987 }
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:

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

Definition at line 988 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

988  {
989  EXPECT_TRUE(update_a_numeric_column("trips",
990  "passenger_count",
991  UpdelTestConfig::fixNumRows,
992  2,
993  4 * 2,
994  4. * 1.0,
995  false));
996 }
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:

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

Definition at line 998 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

998  {
999  EXPECT_TRUE(update_a_numeric_column(
1000  "trips", "trip_time_in_secs", UpdelTestConfig::fixNumRows, 1, 382 * 2, 382 * 2.0));
1001 }
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:

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

Definition at line 1002 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1002  {
1003  EXPECT_TRUE(update_a_numeric_column("trips",
1004  "trip_time_in_secs",
1005  UpdelTestConfig::fixNumRows,
1006  1,
1007  382 * 2,
1008  382 * 1.0,
1009  false));
1010 }
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:

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

Definition at line 1012 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1012  {
1013  EXPECT_TRUE(update_a_numeric_column(
1014  "trips", "trip_time_in_secs", UpdelTestConfig::fixNumRows, 2, 382 * 2, 382. * 1.5));
1015 }
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:

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

Definition at line 1016 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1016  {
1017  EXPECT_TRUE(update_a_numeric_column("trips",
1018  "trip_time_in_secs",
1019  UpdelTestConfig::fixNumRows,
1020  2,
1021  382 * 2,
1022  382. * 1.0,
1023  false));
1024 }
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:

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

Definition at line 1026 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1026  {
1027  EXPECT_TRUE(update_a_numeric_column(
1028  "trips", "trip_distance", UpdelTestConfig::fixNumRows, 1, 1 * 2, 1 * 2.0));
1029 }
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:

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

Definition at line 1030 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1030  {
1031  EXPECT_TRUE(update_a_numeric_column(
1032  "trips", "trip_distance", UpdelTestConfig::fixNumRows, 1, 1 * 2, 1 * 1.0, false));
1033 }
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:

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

Definition at line 1035 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1035  {
1036  EXPECT_TRUE(update_a_numeric_column(
1037  "trips", "trip_distance", UpdelTestConfig::fixNumRows, 2, 1 * 2, 1. * 1.5));
1038 }
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:

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

Definition at line 1039 of file UpdelStorageTest.cpp.

References update_a_numeric_column().

1039  {
1040  EXPECT_TRUE(update_a_numeric_column(
1041  "trips", "trip_distance", UpdelTestConfig::fixNumRows, 2, 1 * 2, 1. * 1.0, false));
1042 }
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:

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

Definition at line 1044 of file UpdelStorageTest.cpp.

References update_a_encoded_string_column().

1044  {
1045  EXPECT_TRUE(update_a_encoded_string_column(
1046  "trips", "vendor_id", UpdelTestConfig::fixNumRows, 1, "abcxyz"));
1047 }
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:

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

Definition at line 1048 of file UpdelStorageTest.cpp.

References update_a_encoded_string_column().

1048  {
1049  EXPECT_TRUE(update_a_encoded_string_column(
1050  "trips", "vendor_id", UpdelTestConfig::fixNumRows, 1, "abcxyz", false));
1051 }
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:

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

Definition at line 1053 of file UpdelStorageTest.cpp.

References update_a_encoded_string_column().

1053  {
1054  EXPECT_TRUE(update_a_encoded_string_column(
1055  "trips", "vendor_id", UpdelTestConfig::fixNumRows, 2, "xyzabc"));
1056 }
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:

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

Definition at line 1057 of file UpdelStorageTest.cpp.

References update_a_encoded_string_column().

1057  {
1058  EXPECT_TRUE(update_a_encoded_string_column(
1059  "trips", "vendor_id", UpdelTestConfig::fixNumRows, 2, "xyzabc", false));
1060 }
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:

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

Definition at line 1062 of file UpdelStorageTest.cpp.

References update_a_boolean_column().

1062  {
1063  EXPECT_TRUE(
1064  update_a_boolean_column("trips", "deleted", UpdelTestConfig::fixNumRows, 1, true));
1065 }
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:

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

Definition at line 1066 of file UpdelStorageTest.cpp.

References update_a_boolean_column().

1066  {
1067  EXPECT_TRUE(update_a_boolean_column(
1068  "trips", "deleted", UpdelTestConfig::fixNumRows, 1, true, false));
1069 }
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:

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

Definition at line 1071 of file UpdelStorageTest.cpp.

References update_a_boolean_column().

1071  {
1072  EXPECT_TRUE(
1073  update_a_boolean_column("trips", "deleted", UpdelTestConfig::fixNumRows, 2, true));
1074 }
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:

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

Definition at line 1075 of file UpdelStorageTest.cpp.

References update_a_boolean_column().

1075  {
1076  EXPECT_TRUE(update_a_boolean_column(
1077  "trips", "deleted", UpdelTestConfig::fixNumRows, 2, true, false));
1078 }
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:

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 311 of file UpdelStorageTest.cpp.

References CHECK_EQ, and anonymous_namespace{AlterColumnTest.cpp}::run_query().

Referenced by TEST_F().

316  {
317  update_common<const std::string>(
318  table, column, cnt, step, val ? "T" : "F", SQLTypeInfo(), commit);
319  // count updated bools
320  std::string query_str =
321  "SELECT count(*) FROM " + table + " WHERE " + (val ? "" : " NOT ") + column + ";";
322  auto rows = run_query(query_str);
323  auto crt_row = rows->getNextRow(true, true);
324  CHECK_EQ(size_t(1), crt_row.size());
325  auto r_cnt = v<int64_t>(crt_row[0]);
326  return r_cnt == (commit ? cnt / step : 0);
327 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
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:

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 292 of file UpdelStorageTest.cpp.

References CHECK_EQ, and anonymous_namespace{AlterColumnTest.cpp}::run_query().

Referenced by TEST_F().

297  {
298  update_common<const std::string>(table, column, cnt, step, val, SQLTypeInfo(), commit);
299  // count updated string
300  std::string query_str =
301  "SELECT count(*) FROM " + table + " WHERE " + column + " = '" + val + "';";
302  auto rows = run_query(query_str);
303  auto crt_row = rows->getNextRow(true, true);
304  CHECK_EQ(size_t(1), crt_row.size());
305  auto r_cnt = v<int64_t>(crt_row[0]);
306  return r_cnt == (commit ? cnt / step : 0);
307 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
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:

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 160 of file UpdelStorageTest.cpp.

References anonymous_namespace{ImportTest.cpp}::compare_agg(), and to_string().

Referenced by TEST_F().

167  {
168  if (by_string) {
169  update_common<std::string>(
170  table, column, cnt, step, std::to_string(val), SQLTypeInfo(), commit);
171  } else {
172  update_common<double>(table, column, cnt, step, val, SQLTypeInfo(), commit);
173  }
174  return compare_agg(table, column, cnt, avg);
175 }
std::string to_string(char const *&&v)
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:845
bool compare_agg(const int64_t cnt, const double avg)
Definition: ImportTest.cpp:71

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 330 of file UpdelStorageTest.cpp.

References CHECK_EQ, convert_decimal_value_to_scale(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_decimal(), anonymous_namespace{AlterColumnTest.cpp}::run_query(), and VLOG.

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

+ Here is the call graph for this function:

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 134 of file UpdelStorageTest.cpp.

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

140  {
141  UpdelRoll updelRoll;
142  std::vector<uint64_t> fragOffsets;
143  std::vector<ScalarTargetValue> rhsValues;
144  update_prepare_offsets_values<T>(cnt, step, val, fragOffsets, rhsValues);
146  QR::get()->getCatalog().get(),
147  table,
148  column,
149  0, // 1st frag since we have only 100 rows
150  fragOffsets,
151  rhsValues,
152  rhsType,
154  updelRoll);
155  if (commit) {
156  updelRoll.commitUpdate();
157  }
158 }
void commitUpdate()
static QueryRunner * get()
Definition: QueryRunner.h:118
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:

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 122 of file UpdelStorageTest.cpp.

126  {
127  for (int64_t i = 0; i < cnt; i += step) {
128  fragOffsets.push_back(i);
129  }
130  rhsValues.push_back(ScalarTargetValue(val));
131 }
boost::variant< int64_t, double, float, NullableString > ScalarTargetValue
Definition: TargetValue.h:156
template<class T >
T anonymous_namespace{UpdelStorageTest.cpp}::v ( const TargetValue r)

Definition at line 95 of file UpdelStorageTest.cpp.

References CHECK.

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

Variable Documentation

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 583 of file UpdelStorageTest.cpp.

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 549 of file UpdelStorageTest.cpp.

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

Definition at line 566 of file UpdelStorageTest.cpp.

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

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 571 of file UpdelStorageTest.cpp.

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

Definition at line 61 of file UpdelStorageTest.cpp.

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

Definition at line 60 of file UpdelStorageTest.cpp.