| 468 | } |
| 469 | |
| 470 | void VerifyOrders(const std::vector<ExecBatch>& batches, |
| 471 | double scale_factor = kDefaultScaleFactor) { |
| 472 | const int64_t kExpectedRows = static_cast<int64_t>(1500000 * scale_factor); |
| 473 | int64_t num_rows = 0; |
| 474 | |
| 475 | std::unordered_set<int32_t> seen_orderkey; |
| 476 | for (auto& batch : batches) { |
| 477 | ValidateBatch(batch); |
| 478 | VerifyUniqueKey(&seen_orderkey, batch[0], |
| 479 | /*min=*/1, |
| 480 | /*max=*/static_cast<int32_t>(4 * kExpectedRows)); |
| 481 | VerifyAllBetween(batch[1], /*min=*/1, /*max=*/static_cast<int32_t>(kExpectedRows)); |
| 482 | VerifyModuloBetween(batch[1], /*min=*/1, /*max=*/2, /*mod=*/3); |
| 483 | VerifyOneOf(batch[2], {'F', 'O', 'P'}); |
| 484 | VerifyAllBetween(batch[4], kStartDate, kEndDate - 151); |
| 485 | VerifyOneOf(batch[5], |
| 486 | /*byte_width=*/15, |
| 487 | { |
| 488 | "1-URGENT", |
| 489 | "2-HIGH", |
| 490 | "3-MEDIUM", |
| 491 | "4-NOT SPECIFIED", |
| 492 | "5-LOW", |
| 493 | }); |
| 494 | VerifyStringAndNumber_FixedWidth(batch[6], Datum(), |
| 495 | /*byte_width=*/15, "Clerk#", |
| 496 | /*verify_padding=*/true); |
| 497 | VerifyAllBetween(batch[7], /*min=*/0, /*max=*/0); |
| 498 | num_rows += batch.length; |
| 499 | } |
| 500 | ASSERT_EQ(seen_orderkey.size(), kExpectedRows); |
| 501 | ASSERT_EQ(num_rows, kExpectedRows); |
| 502 | } |
| 503 | |
| 504 | TEST(TpchNode, Orders) { |
| 505 | ASSERT_OK_AND_ASSIGN(auto res, GenerateTable(&TpchGen::Orders)); |
no test coverage detected