Constructs and closes a hash table.
| 268 | |
| 269 | // Constructs and closes a hash table. |
| 270 | void SetupTest(bool quadratic, int64_t initial_num_buckets, bool too_big) { |
| 271 | TupleRow* build_row1 = CreateTupleRow(1); |
| 272 | TupleRow* build_row2 = CreateTupleRow(2); |
| 273 | TupleRow* probe_row3 = CreateTupleRow(3); |
| 274 | TupleRow* probe_row4 = CreateTupleRow(4); |
| 275 | |
| 276 | int32_t* val_row1 = |
| 277 | reinterpret_cast<int32_t*>(build_expr_evals_[0]->GetValue(build_row1)); |
| 278 | EXPECT_EQ(*val_row1, 1); |
| 279 | int32_t* val_row2 = |
| 280 | reinterpret_cast<int32_t*>(build_expr_evals_[0]->GetValue(build_row2)); |
| 281 | EXPECT_EQ(*val_row2, 2); |
| 282 | int32_t* val_row3 = |
| 283 | reinterpret_cast<int32_t*>(probe_expr_evals_[0]->GetValue(probe_row3)); |
| 284 | EXPECT_EQ(*val_row3, 3); |
| 285 | int32_t* val_row4 = |
| 286 | reinterpret_cast<int32_t*>(probe_expr_evals_[0]->GetValue(probe_row4)); |
| 287 | EXPECT_EQ(*val_row4, 4); |
| 288 | |
| 289 | // Create and close the hash table. |
| 290 | HashTable* hash_table; |
| 291 | bool initialized = CreateHashTable(quadratic, initial_num_buckets, &hash_table); |
| 292 | EXPECT_EQ(too_big, !initialized); |
| 293 | if (initialized && initial_num_buckets > 0) { |
| 294 | EXPECT_NE(hash_table->ByteSize(), 0); |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | // IMPALA-2897: Build rows that are equivalent (where nullptrs are counted as equivalent) |
| 299 | // should not occupy distinct buckets. |