| 344 | } |
| 345 | |
| 346 | void VerifySupplier(const std::vector<ExecBatch>& batches, |
| 347 | double scale_factor = kDefaultScaleFactor) { |
| 348 | int64_t kExpectedRows = static_cast<int64_t>(10000 * scale_factor); |
| 349 | int64_t num_rows = 0; |
| 350 | |
| 351 | std::unordered_set<int32_t> seen_suppkey; |
| 352 | int good_count = 0; |
| 353 | int bad_count = 0; |
| 354 | for (auto& batch : batches) { |
| 355 | ValidateBatch(batch); |
| 356 | VerifyUniqueKey(&seen_suppkey, batch[0], |
| 357 | /*min=*/1, |
| 358 | /*max=*/static_cast<int32_t>(kExpectedRows)); |
| 359 | VerifyStringAndNumber_FixedWidth(batch[1], batch[0], /*byte_width=*/25, "Supplie#r"); |
| 360 | VerifyVString(batch[2], /*min_length=*/10, /*max_length=*/40); |
| 361 | VerifyNationKey(batch[3]); |
| 362 | VerifyPhone(batch[4]); |
| 363 | VerifyDecimalsBetween(batch[5], -99999, 999999); |
| 364 | CountModifiedComments(batch[6], &good_count, &bad_count); |
| 365 | num_rows += batch.length; |
| 366 | } |
| 367 | ASSERT_EQ(seen_suppkey.size(), kExpectedRows); |
| 368 | ASSERT_EQ(num_rows, kExpectedRows); |
| 369 | ASSERT_EQ(good_count, static_cast<int64_t>(5 * scale_factor)); |
| 370 | ASSERT_EQ(bad_count, static_cast<int64_t>(5 * scale_factor)); |
| 371 | } |
| 372 | |
| 373 | TEST(TpchNode, Supplier) { |
| 374 | ASSERT_OK_AND_ASSIGN(auto res, GenerateTable(&TpchGen::Supplier)); |
no test coverage detected