| 197 | }; |
| 198 | |
| 199 | void ProbeTest(HashTable* table, HashTableCtx* ht_ctx, |
| 200 | ProbeTestData* data, int num_data, bool scan) { |
| 201 | for (int i = 0; i < num_data; ++i) { |
| 202 | TupleRow* row = data[i].probe_row; |
| 203 | |
| 204 | HashTable::Iterator iter; |
| 205 | if (ht_ctx->EvalAndHashProbe(row)) continue; |
| 206 | iter = table->FindProbeRow(ht_ctx); |
| 207 | |
| 208 | if (data[i].expected_build_rows.size() == 0) { |
| 209 | EXPECT_TRUE(iter.AtEnd()); |
| 210 | } else { |
| 211 | if (scan) { |
| 212 | map<TupleRow*, bool> matched; |
| 213 | while (!iter.AtEnd()) { |
| 214 | EXPECT_EQ(matched.find(iter.GetRow()), matched.end()); |
| 215 | matched[iter.GetRow()] = true; |
| 216 | iter.Next(); |
| 217 | } |
| 218 | EXPECT_EQ(matched.size(), data[i].expected_build_rows.size()); |
| 219 | for (int j = 0; i < data[j].expected_build_rows.size(); ++j) { |
| 220 | EXPECT_TRUE(matched[data[i].expected_build_rows[j]]); |
| 221 | } |
| 222 | } else { |
| 223 | EXPECT_EQ(data[i].expected_build_rows.size(), 1); |
| 224 | EXPECT_EQ(data[i].expected_build_rows[0]->GetTuple(0), |
| 225 | iter.GetRow()->GetTuple(0)); |
| 226 | ValidateMatch(row, iter.GetRow()); |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | /// Construct hash table and buffer pool client. |
| 233 | /// Returns true if HashTable::Init() was successful. Created objects |
nothing calls this directly
no test coverage detected