OmniSciDB  04ee39c94c
anonymous_namespace{ResultSetTest.cpp} Namespace Reference

Classes

class  ResultSetEmulator
 

Typedefs

using OneRow = std::vector< TargetValue >
 

Functions

bool approx_eq (const double v, const double target, const double eps=0.01)
 
void test_iterate (const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc)
 
std::vector< TargetInfogenerate_test_target_infos ()
 
std::vector< TargetInfogenerate_random_groups_target_infos ()
 
std::vector< TargetInfogenerate_random_groups_nullable_target_infos ()
 
std::vector< OneRowget_rows_sorted_by_col (ResultSet &rs, const size_t col_idx)
 
void test_reduce (const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, NumberGenerator &generator1, NumberGenerator &generator2, const int step)
 
void test_reduce_random_groups (const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, NumberGenerator &generator1, NumberGenerator &generator2, const int prct1, const int prct2, bool silent, const int flow=0)
 
template<typename T >
std::string arr_to_byte_string (const std::vector< T > &in)
 

Variables

std::shared_ptr< StringDictionaryg_sd
 

Typedef Documentation

◆ OneRow

using anonymous_namespace{ResultSetTest.cpp}::OneRow = typedef std::vector<TargetValue>

Definition at line 52 of file ResultSetTest.cpp.

Function Documentation

◆ approx_eq()

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

Definition at line 860 of file ResultSetTest.cpp.

Referenced by test_iterate(), test_reduce(), and test_reduce_random_groups().

860  {
861  return target - eps < v && v < target + eps;
862 }
T v(const TargetValue &r)
+ Here is the caller graph for this function:

◆ arr_to_byte_string()

template<typename T >
std::string anonymous_namespace{ResultSetTest.cpp}::arr_to_byte_string ( const std::vector< T > &  in)

Definition at line 1961 of file ResultSetTest.cpp.

Referenced by TEST().

1961  {
1962  auto data_ptr = reinterpret_cast<const char*>(in.data());
1963  return std::string(data_ptr, data_ptr + in.size() * sizeof(T));
1964 }
+ Here is the caller graph for this function:

◆ generate_random_groups_nullable_target_infos()

std::vector<TargetInfo> anonymous_namespace{ResultSetTest.cpp}::generate_random_groups_nullable_target_infos ( )

Definition at line 950 of file ResultSetTest.cpp.

References kAVG, kCOUNT, kDOUBLE, kINT, kMAX, kMIN, and kSUM.

Referenced by TEST().

950  {
951  std::vector<TargetInfo> target_infos;
952  SQLTypeInfo int_ti(kINT, false);
953  // SQLTypeInfo null_ti(kNULLT, false);
954  SQLTypeInfo double_ti(kDOUBLE, false);
955  target_infos.push_back(TargetInfo{true, kMIN, int_ti, int_ti, true, false});
956  target_infos.push_back(TargetInfo{true, kMAX, int_ti, int_ti, true, false});
957  target_infos.push_back(TargetInfo{true, kSUM, int_ti, int_ti, true, false});
958  target_infos.push_back(TargetInfo{true, kCOUNT, int_ti, int_ti, true, false});
959  target_infos.push_back(TargetInfo{true, kAVG, int_ti, double_ti, true, false});
960  return target_infos;
961 }
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqltypes.h:47
Definition: sqldefs.h:71
Definition: sqldefs.h:71
+ Here is the caller graph for this function:

◆ generate_random_groups_target_infos()

std::vector<TargetInfo> anonymous_namespace{ResultSetTest.cpp}::generate_random_groups_target_infos ( )

Definition at line 937 of file ResultSetTest.cpp.

References kAVG, kCOUNT, kDOUBLE, kINT, kMAX, kMIN, and kSUM.

Referenced by TEST().

937  {
938  std::vector<TargetInfo> target_infos;
939  SQLTypeInfo int_ti(kINT, true);
940  SQLTypeInfo double_ti(kDOUBLE, true);
941  // SQLTypeInfo null_ti(kNULLT, false);
942  target_infos.push_back(TargetInfo{true, kMIN, int_ti, int_ti, true, false});
943  target_infos.push_back(TargetInfo{true, kMAX, int_ti, int_ti, true, false});
944  target_infos.push_back(TargetInfo{true, kSUM, int_ti, int_ti, true, false});
945  target_infos.push_back(TargetInfo{true, kCOUNT, int_ti, int_ti, true, false});
946  target_infos.push_back(TargetInfo{true, kAVG, int_ti, double_ti, true, false});
947  return target_infos;
948 }
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqltypes.h:47
Definition: sqldefs.h:71
Definition: sqldefs.h:71
+ Here is the caller graph for this function:

◆ generate_test_target_infos()

std::vector<TargetInfo> anonymous_namespace{ResultSetTest.cpp}::generate_test_target_infos ( )

Definition at line 919 of file ResultSetTest.cpp.

References kAVG, kDOUBLE, kENCODING_DICT, kINT, kMIN, kNULLT, kSUM, kTEXT, SQLTypeInfoCore< TYPE_FACET_PACK >::set_comp_param(), and SQLTypeInfoCore< TYPE_FACET_PACK >::set_compression().

Referenced by TEST().

919  {
920  std::vector<TargetInfo> target_infos;
921  SQLTypeInfo int_ti(kINT, false);
922  SQLTypeInfo double_ti(kDOUBLE, false);
923  SQLTypeInfo null_ti(kNULLT, false);
924  target_infos.push_back(TargetInfo{false, kMIN, int_ti, null_ti, true, false});
925  target_infos.push_back(TargetInfo{true, kAVG, int_ti, int_ti, true, false});
926  target_infos.push_back(TargetInfo{true, kSUM, int_ti, int_ti, true, false});
927  target_infos.push_back(TargetInfo{false, kMIN, double_ti, null_ti, true, false});
928  {
929  SQLTypeInfo dict_string_ti(kTEXT, false);
930  dict_string_ti.set_compression(kENCODING_DICT);
931  dict_string_ti.set_comp_param(1);
932  target_infos.push_back(TargetInfo{false, kMIN, dict_string_ti, null_ti, true, false});
933  }
934  return target_infos;
935 }
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqltypes.h:54
Definition: sqltypes.h:47
Definition: sqldefs.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_rows_sorted_by_col()

std::vector<OneRow> anonymous_namespace{ResultSetTest.cpp}::get_rows_sorted_by_col ( ResultSet rs,
const size_t  col_idx 
)

Definition at line 963 of file ResultSetTest.cpp.

References run-benchmark-import::result.

Referenced by test_reduce_random_groups().

963  {
964  std::list<Analyzer::OrderEntry> order_entries;
965  order_entries.emplace_back(1, false, false);
966  rs.sort(order_entries, 0);
967  std::vector<OneRow> result;
968 
969  while (true) {
970  const auto row = rs.getNextRow(false, false);
971  if (row.empty()) {
972  break;
973  }
974  result.push_back(row);
975  }
976  return result;
977 }
+ Here is the caller graph for this function:

◆ test_iterate()

void anonymous_namespace{ResultSetTest.cpp}::test_iterate ( const std::vector< TargetInfo > &  target_infos,
const QueryMemoryDescriptor query_mem_desc 
)

Definition at line 867 of file ResultSetTest.cpp.

References approx_eq(), CHECK, CHECK_EQ, CPU, fill_storage_buffer(), QueryMemoryDescriptor::getEntryCount(), kAVG, kBIGINT, kDOUBLE, kINT, kSMALLINT, kTEXT, kTINYINT, and to_string().

Referenced by TEST().

868  {
869  SQLTypeInfo double_ti(kDOUBLE, false);
870  auto row_set_mem_owner = std::make_shared<RowSetMemoryOwner>();
871  StringDictionaryProxy* sdp =
872  row_set_mem_owner->addStringDict(g_sd, 1, g_sd->storageEntryCount());
873  ResultSet result_set(
874  target_infos, ExecutorDeviceType::CPU, query_mem_desc, row_set_mem_owner, nullptr);
875  for (size_t i = 0; i < query_mem_desc.getEntryCount(); ++i) {
876  sdp->getOrAddTransient(std::to_string(i));
877  }
878  const auto storage = result_set.allocateStorage();
879  EvenNumberGenerator generator;
881  storage->getUnderlyingBuffer(), target_infos, query_mem_desc, generator, 2);
882  int64_t ref_val{0};
883  while (true) {
884  const auto row = result_set.getNextRow(true, false);
885  if (row.empty()) {
886  break;
887  }
888  CHECK_EQ(target_infos.size(), row.size());
889  for (size_t i = 0; i < target_infos.size(); ++i) {
890  const auto& target_info = target_infos[i];
891  const auto& ti = target_info.agg_kind == kAVG ? double_ti : target_info.sql_type;
892  switch (ti.get_type()) {
893  case kTINYINT:
894  case kSMALLINT:
895  case kINT:
896  case kBIGINT: {
897  const auto ival = v<int64_t>(row[i]);
898  ASSERT_EQ(ref_val, ival);
899  break;
900  }
901  case kDOUBLE: {
902  const auto dval = v<double>(row[i]);
903  ASSERT_TRUE(approx_eq(static_cast<double>(ref_val), dval));
904  break;
905  }
906  case kTEXT: {
907  const auto sval = v<NullableString>(row[i]);
908  ASSERT_EQ(std::to_string(ref_val), boost::get<std::string>(sval));
909  break;
910  }
911  default:
912  CHECK(false);
913  }
914  }
915  ref_val += 2;
916  }
917 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::string to_string(char const *&&v)
std::shared_ptr< StringDictionary > g_sd
bool approx_eq(const double v, const double target, const double eps=0.01)
Definition: sqltypes.h:54
#define CHECK(condition)
Definition: Logger.h:187
Definition: sqltypes.h:47
Definition: sqldefs.h:71
void fill_storage_buffer(int8_t *buff, const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, NumberGenerator &generator, const size_t step)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_reduce()

void anonymous_namespace{ResultSetTest.cpp}::test_reduce ( const std::vector< TargetInfo > &  target_infos,
const QueryMemoryDescriptor query_mem_desc,
NumberGenerator generator1,
NumberGenerator generator2,
const int  step 
)

Definition at line 979 of file ResultSetTest.cpp.

References approx_eq(), CHECK, CHECK_EQ, CPU, fill_storage_buffer(), kAVG, kBIGINT, kCOUNT, kDOUBLE, kINT, kSMALLINT, kSUM, kTEXT, kTINYINT, and ResultSetManager::reduce().

Referenced by TEST().

983  {
984  SQLTypeInfo double_ti(kDOUBLE, false);
985  const ResultSetStorage* storage1{nullptr};
986  const ResultSetStorage* storage2{nullptr};
987  const auto row_set_mem_owner = std::make_shared<RowSetMemoryOwner>();
988  row_set_mem_owner->addStringDict(g_sd, 1, g_sd->storageEntryCount());
989  const auto rs1 = std::make_unique<ResultSet>(
990  target_infos, ExecutorDeviceType::CPU, query_mem_desc, row_set_mem_owner, nullptr);
991  storage1 = rs1->allocateStorage();
993  storage1->getUnderlyingBuffer(), target_infos, query_mem_desc, generator1, step);
994  const auto rs2 = std::make_unique<ResultSet>(
995  target_infos, ExecutorDeviceType::CPU, query_mem_desc, row_set_mem_owner, nullptr);
996  storage2 = rs2->allocateStorage();
998  storage2->getUnderlyingBuffer(), target_infos, query_mem_desc, generator2, step);
999  ResultSetManager rs_manager;
1000  std::vector<ResultSet*> storage_set{rs1.get(), rs2.get()};
1001  auto result_rs = rs_manager.reduce(storage_set);
1002  int64_t ref_val{0};
1003  std::list<Analyzer::OrderEntry> order_entries;
1004  order_entries.emplace_back(1, false, false);
1005  result_rs->sort(order_entries, 0);
1006  while (true) {
1007  const auto row = result_rs->getNextRow(false, false);
1008  if (row.empty()) {
1009  break;
1010  }
1011  CHECK_EQ(target_infos.size(), row.size());
1012  for (size_t i = 0; i < target_infos.size(); ++i) {
1013  const auto& target_info = target_infos[i];
1014  const auto& ti = target_info.agg_kind == kAVG ? double_ti : target_info.sql_type;
1015  switch (ti.get_type()) {
1016  case kTINYINT:
1017  case kSMALLINT:
1018  case kINT:
1019  case kBIGINT: {
1020  const auto ival = v<int64_t>(row[i]);
1021  ASSERT_EQ((target_info.agg_kind == kSUM || target_info.agg_kind == kCOUNT)
1022  ? step * ref_val
1023  : ref_val,
1024  ival);
1025  break;
1026  }
1027  case kDOUBLE: {
1028  const auto dval = v<double>(row[i]);
1029  ASSERT_TRUE(approx_eq(static_cast<double>((target_info.agg_kind == kSUM ||
1030  target_info.agg_kind == kCOUNT)
1031  ? step * ref_val
1032  : ref_val),
1033  dval));
1034  break;
1035  }
1036  case kTEXT:
1037  break;
1038  default:
1039  CHECK(false);
1040  }
1041  }
1042  ref_val += step;
1043  }
1044 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::shared_ptr< StringDictionary > g_sd
Definition: sqldefs.h:71
bool approx_eq(const double v, const double target, const double eps=0.01)
Definition: sqltypes.h:54
Definition: sqldefs.h:71
#define CHECK(condition)
Definition: Logger.h:187
Definition: sqltypes.h:47
Definition: sqldefs.h:71
ResultSet * reduce(std::vector< ResultSet *> &)
void fill_storage_buffer(int8_t *buff, const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, NumberGenerator &generator, const size_t step)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_reduce_random_groups()

void anonymous_namespace{ResultSetTest.cpp}::test_reduce_random_groups ( const std::vector< TargetInfo > &  target_infos,
const QueryMemoryDescriptor query_mem_desc,
NumberGenerator generator1,
NumberGenerator generator2,
const int  prct1,
const int  prct2,
bool  silent,
const int  flow = 0 
)

Definition at line 1046 of file ResultSetTest.cpp.

References approx_eq(), CHECK, CHECK_EQ, CPU, logger::FATAL, get_rows_sorted_by_col(), QueryMemoryDescriptor::getQueryDescriptionType(), anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::getReferenceGroupMap(), anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::getReferenceGroupMapElement(), anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::getReferenceRow(), anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::getReferenceTable(), GroupByBaselineHash, GroupByPerfectHash, kAVG, kBIGINT, kCOUNT, kDOUBLE, kINT, kMAX, kMIN, kSMALLINT, kSUM, LOG, anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::print_merged_result_sets(), anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::print_rse_generated_result_sets(), ResultSetManager::reduce(), and run-benchmark-import::result.

Referenced by TEST().

1053  {
1054  SQLTypeInfo double_ti(kDOUBLE, false);
1055  const ResultSetStorage* storage1{nullptr};
1056  const ResultSetStorage* storage2{nullptr};
1057  std::unique_ptr<ResultSet> rs1;
1058  std::unique_ptr<ResultSet> rs2;
1059  const auto row_set_mem_owner = std::make_shared<RowSetMemoryOwner>();
1060  switch (query_mem_desc.getQueryDescriptionType()) {
1062  rs1.reset(new ResultSet(target_infos,
1064  query_mem_desc,
1065  row_set_mem_owner,
1066  nullptr));
1067  storage1 = rs1->allocateStorage();
1068  rs2.reset(new ResultSet(target_infos,
1070  query_mem_desc,
1071  row_set_mem_owner,
1072  nullptr));
1073  storage2 = rs2->allocateStorage();
1074  break;
1075  }
1077  rs1.reset(new ResultSet(target_infos,
1079  query_mem_desc,
1080  row_set_mem_owner,
1081  nullptr));
1082  storage1 = rs1->allocateStorage();
1083  rs2.reset(new ResultSet(target_infos,
1085  query_mem_desc,
1086  row_set_mem_owner,
1087  nullptr));
1088  storage2 = rs2->allocateStorage();
1089  break;
1090  }
1091  default:
1092  CHECK(false);
1093  }
1094 
1095  ResultSetEmulator* rse = new ResultSetEmulator(storage1->getUnderlyingBuffer(),
1096  storage2->getUnderlyingBuffer(),
1097  target_infos,
1098  query_mem_desc,
1099  generator1,
1100  generator2,
1101  prct1,
1102  prct2,
1103  flow,
1104  silent);
1105  if (!silent) {
1106  rse->print_rse_generated_result_sets();
1107  }
1108 
1109  ResultSetManager rs_manager;
1110  std::vector<ResultSet*> storage_set{rs1.get(), rs2.get()};
1111  auto result_rs = rs_manager.reduce(storage_set);
1112  std::queue<std::vector<int64_t>> ref_table = rse->getReferenceTable();
1113  std::vector<bool> ref_group_map = rse->getReferenceGroupMap();
1114  const auto result = get_rows_sorted_by_col(*result_rs, 0);
1115  CHECK(!result.empty());
1116 
1117  if (!silent) {
1118  rse->print_merged_result_sets(result);
1119  }
1120 
1121  size_t row_idx = 0;
1122  int64_t ref_val = 0;
1123  for (const auto& row : result) {
1124  CHECK_EQ(target_infos.size(), row.size());
1125  while (true) {
1126  if (row_idx >= rse->getReferenceGroupMap().size()) {
1127  LOG(FATAL) << "Number of groups in reduced result set is more than expected";
1128  }
1129  if (rse->getReferenceGroupMapElement(row_idx)) {
1130  break;
1131  } else {
1132  row_idx++;
1133  continue;
1134  }
1135  }
1136  std::vector<int64_t> ref_row = rse->getReferenceRow();
1137  for (size_t i = 0; i < target_infos.size(); ++i) {
1138  ref_val = ref_row[i];
1139  const auto& target_info = target_infos[i];
1140  const auto& ti = target_info.agg_kind == kAVG ? double_ti : target_info.sql_type;
1141  std::string p_tag("");
1142  if (flow == 2) { // null_val test-cases
1143  p_tag += "kNULLT_";
1144  }
1145  switch (ti.get_type()) {
1146  case kSMALLINT:
1147  case kINT:
1148  case kBIGINT: {
1149  const auto ival = v<int64_t>(row[i]);
1150  switch (target_info.agg_kind) {
1151  case kMIN: {
1152  if (!silent) {
1153  p_tag += "KMIN";
1154  printf("\n%s row_idx = %i, ref_val = %lld, ival = %lld",
1155  p_tag.c_str(),
1156  static_cast<int>(row_idx),
1157  static_cast<long long>(ref_val),
1158  static_cast<long long>(ival));
1159  if (ref_val != ival) {
1160  printf("%21s%s%s", "", p_tag.c_str(), " TEST FAILED!\n");
1161  } else {
1162  printf("%21s%s%s", "", p_tag.c_str(), " TEST PASSED!\n");
1163  }
1164  } else {
1165  ASSERT_EQ(ref_val, ival);
1166  }
1167  break;
1168  }
1169  case kMAX: {
1170  if (!silent) {
1171  p_tag += "KMAX";
1172  printf("\n%s row_idx = %i, ref_val = %lld, ival = %lld",
1173  p_tag.c_str(),
1174  static_cast<int>(row_idx),
1175  static_cast<long long>(ref_val),
1176  static_cast<long long>(ival));
1177  if (ref_val != ival) {
1178  printf("%21s%s%s", "", p_tag.c_str(), " TEST FAILED!\n");
1179  } else {
1180  printf("%21s%s%s", "", p_tag.c_str(), " TEST PASSED!\n");
1181  }
1182  } else {
1183  ASSERT_EQ(ref_val, ival);
1184  }
1185  break;
1186  }
1187  case kAVG: {
1188  if (!silent) {
1189  p_tag += "KAVG";
1190  printf("\n%s row_idx = %i, ref_val = %lld, ival = %lld",
1191  p_tag.c_str(),
1192  static_cast<int>(row_idx),
1193  static_cast<long long>(ref_val),
1194  static_cast<long long>(ival));
1195  if (ref_val != ival) {
1196  printf("%21s%s%s", "", p_tag.c_str(), " TEST FAILED1!\n");
1197  } else {
1198  printf("%21s%s%s", "", p_tag.c_str(), " TEST PASSED!\n");
1199  }
1200  } else {
1201  ASSERT_EQ(ref_val, ival);
1202  }
1203  break;
1204  }
1205  case kSUM:
1206  case kCOUNT: {
1207  if (!silent) {
1208  p_tag += "KSUM";
1209  printf("\n%s row_idx = %i, ref_val = %lld, ival = %lld",
1210  p_tag.c_str(),
1211  static_cast<int>(row_idx),
1212  static_cast<long long>(ref_val),
1213  static_cast<long long>(ival));
1214  if (ref_val != ival) {
1215  printf("%21s%s%s", "", p_tag.c_str(), " TEST FAILED!\n");
1216  } else {
1217  printf("%21s%s%s", "", p_tag.c_str(), " TEST PASSED!\n");
1218  }
1219  } else {
1220  ASSERT_EQ(ref_val, ival);
1221  }
1222  break;
1223  }
1224  default:
1225  CHECK(false);
1226  }
1227  break;
1228  }
1229  case kDOUBLE: {
1230  const auto dval = v<double>(row[i]);
1231  switch (target_info.agg_kind) {
1232  case kMIN: {
1233  if (!silent) {
1234  p_tag += "KMIN_D";
1235  printf("\nKMIN_D row_idx = %i, ref_val = %f, dval = %f",
1236  static_cast<int>(row_idx),
1237  static_cast<double>(ref_val),
1238  dval);
1239  if (!approx_eq(static_cast<double>(ref_val), dval)) {
1240  printf("%5s%s%s", "", p_tag.c_str(), " TEST FAILED!\n");
1241  } else {
1242  printf("%5s%s%s", "", p_tag.c_str(), " TEST PASSED!\n");
1243  }
1244  } else {
1245  ASSERT_TRUE(approx_eq(static_cast<double>(ref_val), dval));
1246  }
1247  break;
1248  }
1249  case kMAX: {
1250  if (!silent) {
1251  p_tag += "KMAX_D";
1252  printf("\n%s row_idx = %i, ref_val = %f, dval = %f",
1253  p_tag.c_str(),
1254  static_cast<int>(row_idx),
1255  static_cast<double>(ref_val),
1256  dval);
1257  if (!approx_eq(static_cast<double>(ref_val), dval)) {
1258  printf("%5s%s%s", "", p_tag.c_str(), " TEST FAILED!\n");
1259  } else {
1260  printf("%5s%s%s", "", p_tag.c_str(), " TEST PASSED!\n");
1261  }
1262  } else {
1263  ASSERT_TRUE(approx_eq(static_cast<double>(ref_val), dval));
1264  }
1265  break;
1266  }
1267  case kAVG: {
1268  if (!silent) {
1269  p_tag += "KAVG_D";
1270  printf("\n%s row_idx = %i, ref_val = %f, dval = %f",
1271  p_tag.c_str(),
1272  static_cast<int>(row_idx),
1273  static_cast<double>(ref_val),
1274  dval);
1275  if (!approx_eq(static_cast<double>(ref_val), dval)) {
1276  printf("%5s%s%s", "", p_tag.c_str(), " TEST FAILED!\n");
1277  } else {
1278  printf("%5s%s%s", "", p_tag.c_str(), " TEST PASSED!\n");
1279  }
1280  } else {
1281  ASSERT_TRUE(approx_eq(static_cast<double>(ref_val), dval));
1282  }
1283  break;
1284  }
1285  case kSUM:
1286  case kCOUNT: {
1287  if (!silent) {
1288  p_tag += "KSUM_D";
1289  printf("\n%s row_idx = %i, ref_val = %f, dval = %f",
1290  p_tag.c_str(),
1291  (int)row_idx,
1292  (double)ref_val,
1293  dval);
1294  if (!approx_eq(static_cast<double>(ref_val), dval)) {
1295  printf("%5s%s%s", "", p_tag.c_str(), " TEST FAILED!\n");
1296  } else {
1297  printf("%5s%s%s", "", p_tag.c_str(), " TEST PASSED!\n");
1298  }
1299  } else {
1300  ASSERT_TRUE(approx_eq(static_cast<double>(ref_val), dval));
1301  }
1302  break;
1303  }
1304  default:
1305  CHECK(false);
1306  }
1307  break;
1308  }
1309  default:
1310  CHECK(false);
1311  }
1312  }
1313  row_idx++;
1314  }
1315 
1316  delete rse;
1317 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
#define LOG(tag)
Definition: Logger.h:182
std::vector< OneRow > get_rows_sorted_by_col(ResultSet &rs, const size_t col_idx)
Definition: sqldefs.h:71
Definition: sqldefs.h:71
bool approx_eq(const double v, const double target, const double eps=0.01)
Definition: sqldefs.h:71
#define CHECK(condition)
Definition: Logger.h:187
Definition: sqltypes.h:47
QueryDescriptionType getQueryDescriptionType() const
Definition: sqldefs.h:71
Definition: sqldefs.h:71
ResultSet * reduce(std::vector< ResultSet *> &)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ g_sd

std::shared_ptr<StringDictionary> anonymous_namespace{ResultSetTest.cpp}::g_sd
Initial value:
=
std::make_shared<StringDictionary>("", false, true)

Definition at line 864 of file ResultSetTest.cpp.