OmniSciDB  04ee39c94c
ColumnarResultsTest.cpp File Reference

Provides unit tests for the ColumnarResults class. More...

+ Include dependency graph for ColumnarResultsTest.cpp:

Go to the source code of this file.

Functions

void test_perfect_hash_columnar_conversion (const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
 
 TEST (Construct, Empty)
 
 TEST (PerfectHash, RowWise_64Key_64Agg)
 
 TEST (PerfectHash, RowWise_32Key_64Agg)
 
 TEST (PerfectHash, RowWise_64Key_MixedAggs)
 
 TEST (PerfectHash, RowWise_32Key_MixedAggs)
 
 TEST (PerfectHash, Columnar_64Key_64Agg_w_avg)
 
 TEST (PerfectHash, Columnar_64Key_64Agg_wo_avg)
 
 TEST (PerfectHash, Columnar_64Key_MixedAggs_w_avg)
 
 TEST (PerfectHash, Columnar_64Key_MixedAggs_wo_avg)
 
 TEST (PerfectHash, Columnar_32Key_MixedAggs_w_avg)
 
 TEST (PerfectHash, Columnar_32Key_MixedAggs_wo_avg)
 
 TEST (PerfectHash, Columnar_16Key_MixedAggs_w_avg)
 
 TEST (PerfectHash, Columnar_16Key_MixedAggs_wo_avg)
 
 TEST (PerfectHash, Columnar_8Key_MixedAggs_w_avg)
 
 TEST (PerfectHash, Columnar_8Key_MixedAggs_wo_avg)
 
int main (int argc, char **argv)
 

Detailed Description

Provides unit tests for the ColumnarResults class.

Author
Saman Ashkiani saman.nosp@m..ash.nosp@m.kiani.nosp@m.@omn.nosp@m.isci..nosp@m.com

Definition in file ColumnarResultsTest.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 406 of file ColumnarResultsTest.cpp.

References logger::ERROR, TestHelpers::init_logger_stderr_only(), and LOG.

406  {
408  testing::InitGoogleTest(&argc, argv);
409 
410  int err{0};
411  try {
412  err = RUN_ALL_TESTS();
413  } catch (const std::exception& e) {
414  LOG(ERROR) << e.what();
415  }
416  return err;
417 }
#define LOG(tag)
Definition: Logger.h:182
void init_logger_stderr_only(int argc, char const *const *argv)
Definition: TestHelpers.h:194
+ Here is the call graph for this function:

◆ TEST() [1/15]

TEST ( Construct  ,
Empty   
)

Definition at line 126 of file ColumnarResultsTest.cpp.

References CPU.

126  {
127  std::vector<TargetInfo> target_infos;
128  std::vector<SQLTypeInfo> sql_type_infos;
129  QueryMemoryDescriptor query_mem_desc;
130  auto row_set_mem_owner = std::make_shared<RowSetMemoryOwner>();
131  ResultSet result_set(
132  target_infos, ExecutorDeviceType::CPU, query_mem_desc, row_set_mem_owner, nullptr);
133  ColumnarResults columnar_results(
134  row_set_mem_owner, result_set, sql_type_infos.size(), sql_type_infos);
135 }

◆ TEST() [2/15]

TEST ( PerfectHash  ,
RowWise_64Key_64Agg   
)

Definition at line 141 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kAVG, kBIGINT, kCOUNT, kDOUBLE, kMAX, kMIN, kSUM, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

141  {
142  std::vector<int8_t> key_column_widths{8};
143  const int8_t suggested_agg_width = 8;
144  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
145  key_column_widths,
146  {kSUM, kSUM, kCOUNT, kAVG, kMAX, kMIN},
147  {kBIGINT, kBIGINT, kBIGINT, kDOUBLE, kBIGINT, kBIGINT},
148  {kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT});
149  auto query_mem_desc =
150  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
151  for (auto is_parallel : {false, true}) {
152  for (auto step_size : {1, 2, 13, 67, 127}) {
154  target_infos, query_mem_desc, step_size, is_parallel);
155  }
156  }
157 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
Definition: sqldefs.h:71
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [3/15]

TEST ( PerfectHash  ,
RowWise_32Key_64Agg   
)

Definition at line 159 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kAVG, kBIGINT, kCOUNT, kDOUBLE, kMAX, kMIN, kSUM, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

159  {
160  std::vector<int8_t> key_column_widths{4};
161  const int8_t suggested_agg_width = 8;
162  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
163  key_column_widths,
164  {kSUM, kSUM, kCOUNT, kAVG, kMAX, kMIN},
165  {kBIGINT, kBIGINT, kBIGINT, kDOUBLE, kBIGINT, kBIGINT},
166  {kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT});
167  auto query_mem_desc =
168  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
169  for (auto is_parallel : {false, true}) {
170  for (auto step_size : {1, 3, 17, 33, 117}) {
172  target_infos, query_mem_desc, step_size, is_parallel);
173  }
174  }
175 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
Definition: sqldefs.h:71
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [4/15]

TEST ( PerfectHash  ,
RowWise_64Key_MixedAggs   
)

Definition at line 177 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

177  {
178  std::vector<int8_t> key_column_widths{8};
179  const int8_t suggested_agg_width = 8;
180  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
181  key_column_widths,
182  {kMAX, kMAX, kMAX, kMAX, kMAX, kMAX},
184  {kTINYINT, kSMALLINT, kINT, kBIGINT, kFLOAT, kDOUBLE});
185  auto query_mem_desc =
186  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
187  for (auto is_parallel : {false, true}) {
188  for (auto step_size : {2, 13, 67, 127}) {
190  target_infos, query_mem_desc, step_size, is_parallel);
191  }
192  }
193 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [5/15]

TEST ( PerfectHash  ,
RowWise_32Key_MixedAggs   
)

Definition at line 195 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

195  {
196  std::vector<int8_t> key_column_widths{4};
197  const int8_t suggested_agg_width = 8;
198  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
199  key_column_widths,
200  {kMAX, kMAX, kMAX, kMAX, kMAX, kMAX},
202  {kDOUBLE, kFLOAT, kBIGINT, kINT, kSMALLINT, kTINYINT});
203  auto query_mem_desc =
204  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
205  for (auto is_parallel : {false, true}) {
206  for (auto step_size : {3, 7, 17, 33, 117}) {
208  target_infos, query_mem_desc, step_size, is_parallel);
209  }
210  }
211 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [6/15]

TEST ( PerfectHash  ,
Columnar_64Key_64Agg_w_avg   
)

Definition at line 213 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kAVG, kBIGINT, kCOUNT, kDOUBLE, kMAX, kMIN, kSUM, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

213  {
214  std::vector<int8_t> key_column_widths{8};
215  const int8_t suggested_agg_width = 8;
216  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
217  key_column_widths,
218  {kSUM, kSUM, kCOUNT, kAVG, kMAX, kAVG, kMIN},
219  {kBIGINT, kBIGINT, kBIGINT, kDOUBLE, kBIGINT, kDOUBLE, kBIGINT},
220  {kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT});
221  auto query_mem_desc =
222  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
223  query_mem_desc.setOutputColumnar(true);
224  for (auto is_parallel : {false, true}) {
225  for (auto step_size : {1, 2, 13, 67, 127}) {
227  target_infos, query_mem_desc, step_size, is_parallel);
228  }
229  }
230 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
Definition: sqldefs.h:71
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [7/15]

TEST ( PerfectHash  ,
Columnar_64Key_64Agg_wo_avg   
)

Definition at line 232 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kBIGINT, kCOUNT, kMAX, kMIN, kSUM, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

232  {
233  std::vector<int8_t> key_column_widths{8};
234  const int8_t suggested_agg_width = 8;
235  std::vector<TargetInfo> target_infos =
236  generate_custom_agg_target_infos(key_column_widths,
237  {kSUM, kSUM, kCOUNT, kMAX, kMIN},
238  {kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT},
239  {kBIGINT, kBIGINT, kBIGINT, kBIGINT, kBIGINT});
240  auto query_mem_desc =
241  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
242  query_mem_desc.setOutputColumnar(true);
243  for (auto is_parallel : {false, true}) {
244  for (auto step_size : {1, 2, 13, 67, 127}) {
246  target_infos, query_mem_desc, step_size, is_parallel);
247  }
248  }
249 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
Definition: sqldefs.h:71
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqldefs.h:71
Definition: sqldefs.h:71
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [8/15]

TEST ( PerfectHash  ,
Columnar_64Key_MixedAggs_w_avg   
)

Definition at line 251 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kAVG, kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

251  {
252  std::vector<int8_t> key_column_widths{8};
253  const int8_t suggested_agg_width = 1;
254  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
255  key_column_widths,
256  {kMAX, kMAX, kAVG, kMAX, kMAX, kAVG, kMAX, kMAX},
258  {kDOUBLE, kFLOAT, kINT, kBIGINT, kINT, kSMALLINT, kSMALLINT, kTINYINT});
259  auto query_mem_desc =
260  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
261  query_mem_desc.setOutputColumnar(true);
262  for (auto is_parallel : {false, true}) {
263  for (auto step_size : {3, 7, 16, 37, 127}) {
265  target_infos, query_mem_desc, step_size, is_parallel);
266  }
267  }
268 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [9/15]

TEST ( PerfectHash  ,
Columnar_64Key_MixedAggs_wo_avg   
)

Definition at line 270 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

270  {
271  std::vector<int8_t> key_column_widths{8};
272  const int8_t suggested_agg_width = 1;
273  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
274  key_column_widths,
275  {kMAX, kMAX, kMAX, kMAX, kMAX, kMAX},
277  {kDOUBLE, kFLOAT, kBIGINT, kINT, kSMALLINT, kTINYINT});
278  auto query_mem_desc =
279  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
280  query_mem_desc.setOutputColumnar(true);
281  for (auto is_parallel : {false, true}) {
282  for (auto step_size : {3, 7, 16, 37, 127}) {
284  target_infos, query_mem_desc, step_size, is_parallel);
285  }
286  }
287 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [10/15]

TEST ( PerfectHash  ,
Columnar_32Key_MixedAggs_w_avg   
)

Definition at line 289 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kAVG, kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

289  {
290  std::vector<int8_t> key_column_widths{4};
291  const int8_t suggested_agg_width = 1;
292  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
293  key_column_widths,
294  {kMAX, kMAX, kAVG, kAVG, kMAX, kMAX, kMAX, kMAX},
296  {kDOUBLE, kFLOAT, kBIGINT, kTINYINT, kBIGINT, kINT, kSMALLINT, kTINYINT});
297  auto query_mem_desc =
298  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
299  query_mem_desc.setOutputColumnar(true);
300  for (auto is_parallel : {false, true}) {
301  for (auto step_size : {3, 7, 16, 37, 127}) {
303  target_infos, query_mem_desc, step_size, is_parallel);
304  }
305  }
306 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [11/15]

TEST ( PerfectHash  ,
Columnar_32Key_MixedAggs_wo_avg   
)

Definition at line 308 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

308  {
309  std::vector<int8_t> key_column_widths{4};
310  const int8_t suggested_agg_width = 1;
311  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
312  key_column_widths,
313  {kMAX, kMAX, kMAX, kMAX, kMAX, kMAX},
315  {kDOUBLE, kFLOAT, kBIGINT, kINT, kSMALLINT, kTINYINT});
316  auto query_mem_desc =
317  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
318  query_mem_desc.setOutputColumnar(true);
319  for (auto is_parallel : {false, true}) {
320  for (auto step_size : {3, 7, 16, 37, 127}) {
322  target_infos, query_mem_desc, step_size, is_parallel);
323  }
324  }
325 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [12/15]

TEST ( PerfectHash  ,
Columnar_16Key_MixedAggs_w_avg   
)

Definition at line 327 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kAVG, kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

327  {
328  std::vector<int8_t> key_column_widths{2};
329  const int8_t suggested_agg_width = 1;
330  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
331  key_column_widths,
332  {kMAX, kAVG, kMAX, kMAX, kMAX, kMAX, kAVG, kMAX},
334  {kDOUBLE, kINT, kFLOAT, kBIGINT, kINT, kSMALLINT, kBIGINT, kTINYINT});
335  auto query_mem_desc =
336  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
337  query_mem_desc.setOutputColumnar(true);
338  for (auto is_parallel : {false, true}) {
339  for (auto step_size : {3, 7, 16, 37, 127}) {
341  target_infos, query_mem_desc, step_size, is_parallel);
342  }
343  }
344 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [13/15]

TEST ( PerfectHash  ,
Columnar_16Key_MixedAggs_wo_avg   
)

Definition at line 346 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

346  {
347  std::vector<int8_t> key_column_widths{2};
348  const int8_t suggested_agg_width = 1;
349  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
350  key_column_widths,
351  {kMAX, kMAX, kMAX, kMAX, kMAX, kMAX},
353  {kDOUBLE, kFLOAT, kBIGINT, kINT, kSMALLINT, kTINYINT});
354  auto query_mem_desc =
355  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
356  query_mem_desc.setOutputColumnar(true);
357  for (auto is_parallel : {false, true}) {
358  for (auto step_size : {3, 7, 16, 37, 127}) {
360  target_infos, query_mem_desc, step_size, is_parallel);
361  }
362  }
363 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [14/15]

TEST ( PerfectHash  ,
Columnar_8Key_MixedAggs_w_avg   
)

Definition at line 365 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kAVG, kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

365  {
366  std::vector<int8_t> key_column_widths{1};
367  const int8_t suggested_agg_width = 1;
368  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
369  key_column_widths,
370  {kMAX, kMAX, kMAX, kMAX, kAVG, kMAX, kAVG, kMAX},
372  {kDOUBLE, kFLOAT, kBIGINT, kINT, kINT, kSMALLINT, kSMALLINT, kTINYINT});
373  auto query_mem_desc =
374  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
375  query_mem_desc.setOutputColumnar(true);
376  for (auto is_parallel : {false, true}) {
377  for (auto step_size : {3, 7, 16, 37, 127}) {
379  target_infos, query_mem_desc, step_size, is_parallel);
380  }
381  }
382 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ TEST() [15/15]

TEST ( PerfectHash  ,
Columnar_8Key_MixedAggs_wo_avg   
)

Definition at line 384 of file ColumnarResultsTest.cpp.

References generate_custom_agg_target_infos(), kBIGINT, kDOUBLE, kFLOAT, kINT, kMAX, kSMALLINT, kTINYINT, perfect_hash_one_col_desc(), and test_perfect_hash_columnar_conversion().

384  {
385  std::vector<int8_t> key_column_widths{1};
386  const int8_t suggested_agg_width = 1;
387  std::vector<TargetInfo> target_infos = generate_custom_agg_target_infos(
388  key_column_widths,
389  {kMAX, kMAX, kMAX, kMAX, kMAX, kMAX},
391  {kDOUBLE, kFLOAT, kBIGINT, kINT, kSMALLINT, kTINYINT});
392  auto query_mem_desc =
393  perfect_hash_one_col_desc(target_infos, suggested_agg_width, 0, 118);
394  query_mem_desc.setOutputColumnar(true);
395  for (auto is_parallel : {false, true}) {
396  for (auto step_size : {3, 7, 16, 37, 127}) {
398  target_infos, query_mem_desc, step_size, is_parallel);
399  }
400  }
401 }
void test_perfect_hash_columnar_conversion(const std::vector< TargetInfo > &target_infos, const QueryMemoryDescriptor &query_mem_desc, const size_t non_empty_step_size, const bool is_parallel_conversion=false)
QueryMemoryDescriptor perfect_hash_one_col_desc(const std::vector< TargetInfo > &target_infos, const int8_t num_bytes, const size_t min_val, const size_t max_val, std::vector< int8_t > group_column_widths)
Definition: sqltypes.h:47
Definition: sqldefs.h:71
std::vector< TargetInfo > generate_custom_agg_target_infos(std::vector< int8_t > group_columns, std::vector< SQLAgg > sql_aggs, std::vector< SQLTypes > agg_types, std::vector< SQLTypes > arg_types)
+ Here is the call graph for this function:

◆ test_perfect_hash_columnar_conversion()

void test_perfect_hash_columnar_conversion ( const std::vector< TargetInfo > &  target_infos,
const QueryMemoryDescriptor query_mem_desc,
const size_t  non_empty_step_size,
const bool  is_parallel_conversion = false 
)

Definition at line 33 of file ColumnarResultsTest.cpp.

References CHECK_EQ, CPU, fill_storage_buffer(), get_logical_type_info(), kAVG, kBIGINT, kDOUBLE, kFLOAT, kINT, kSMALLINT, kTINYINT, ColumnarResults::setParallelConversion(), and UNREACHABLE.

Referenced by TEST().

36  {
37  auto row_set_mem_owner = std::make_shared<RowSetMemoryOwner>();
38  ResultSet result_set(
39  target_infos, ExecutorDeviceType::CPU, query_mem_desc, row_set_mem_owner, nullptr);
40 
41  // fill the storage
42  const auto storage = result_set.allocateStorage();
43  EvenNumberGenerator generator;
44  fill_storage_buffer(storage->getUnderlyingBuffer(),
45  target_infos,
46  query_mem_desc,
47  generator,
48  non_empty_step_size);
49 
50  // Columnar Conversion:
51  std::vector<SQLTypeInfo> col_types;
52  for (size_t i = 0; i < result_set.colCount(); ++i) {
53  col_types.push_back(get_logical_type_info(result_set.getColType(i)));
54  }
55  ColumnarResults columnar_results(
56  row_set_mem_owner, result_set, col_types.size(), col_types);
57  columnar_results.setParallelConversion(is_parallel_conversion);
58 
59  // Validate the results:
60  for (size_t rs_row_idx = 0, cr_row_idx = 0; rs_row_idx < query_mem_desc.getEntryCount();
61  rs_row_idx++) {
62  if (result_set.isRowAtEmpty(rs_row_idx)) {
63  // empty entries should be filtered out for conversion:
64  continue;
65  }
66  const auto row = result_set.getRowAt(rs_row_idx);
67  if (row.empty()) {
68  break;
69  }
70  CHECK_EQ(target_infos.size(), row.size());
71  for (size_t target_idx = 0; target_idx < target_infos.size(); ++target_idx) {
72  const auto& target_info = target_infos[target_idx];
73  const auto& ti = target_info.agg_kind == kAVG ? SQLTypeInfo{kDOUBLE, false}
74  : target_info.sql_type;
75  switch (ti.get_type()) {
76  case kBIGINT: {
77  const auto ival_result_set = v<int64_t>(row[target_idx]);
78  const auto ival_converted = static_cast<int64_t>(
79  columnar_results.getEntryAt<int64_t>(cr_row_idx, target_idx));
80  ASSERT_EQ(ival_converted, ival_result_set);
81  break;
82  }
83  case kINT: {
84  const auto ival_result_set = v<int64_t>(row[target_idx]);
85  const auto ival_converted = static_cast<int64_t>(
86  columnar_results.getEntryAt<int32_t>(cr_row_idx, target_idx));
87  ASSERT_EQ(ival_converted, ival_result_set);
88  break;
89  }
90  case kSMALLINT: {
91  const auto ival_result_set = v<int64_t>(row[target_idx]);
92  const auto ival_converted = static_cast<int64_t>(
93  columnar_results.getEntryAt<int16_t>(cr_row_idx, target_idx));
94  ASSERT_EQ(ival_result_set, ival_converted);
95  break;
96  }
97  case kTINYINT: {
98  const auto ival_result_set = v<int64_t>(row[target_idx]);
99  const auto ival_converted = static_cast<int64_t>(
100  columnar_results.getEntryAt<int8_t>(cr_row_idx, target_idx));
101  ASSERT_EQ(ival_converted, ival_result_set);
102  break;
103  }
104  case kFLOAT: {
105  const auto fval_result_set = v<float>(row[target_idx]);
106  const auto fval_converted =
107  columnar_results.getEntryAt<float>(cr_row_idx, target_idx);
108  ASSERT_FLOAT_EQ(fval_result_set, fval_converted);
109  break;
110  }
111  case kDOUBLE: {
112  const auto dval_result_set = v<double>(row[target_idx]);
113  const auto dval_converted =
114  columnar_results.getEntryAt<double>(cr_row_idx, target_idx);
115  ASSERT_FLOAT_EQ(dval_result_set, dval_converted);
116  break;
117  }
118  default:
119  UNREACHABLE() << "Invalid type info encountered.";
120  }
121  }
122  cr_row_idx++;
123  }
124 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
#define UNREACHABLE()
Definition: Logger.h:231
SQLTypeInfo get_logical_type_info(const SQLTypeInfo &type_info)
Definition: sqltypes.h:840
void setParallelConversion(const bool is_parallel)
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: