| 507 | } |
| 508 | |
| 509 | void VerifyLineitem(const std::vector<ExecBatch>& batches, |
| 510 | double scale_factor = kDefaultScaleFactor) { |
| 511 | std::unordered_map<int32_t, int32_t> counts; |
| 512 | for (auto& batch : batches) { |
| 513 | ValidateBatch(batch); |
| 514 | CountInstances(&counts, batch[0]); |
| 515 | VerifyAllBetween(batch[1], /*min=*/1, |
| 516 | /*max=*/static_cast<int32_t>(200000 * scale_factor)); |
| 517 | VerifyAllBetween(batch[3], /*min=*/1, /*max=*/7); |
| 518 | VerifyDecimalsBetween(batch[4], /*min=*/100, /*max=*/5000); |
| 519 | VerifyDecimalsBetween(batch[6], /*min=*/0, /*max=*/10); |
| 520 | VerifyDecimalsBetween(batch[7], /*min=*/0, /*max=*/8); |
| 521 | VerifyOneOf(batch[8], {'R', 'A', 'N'}); |
| 522 | VerifyOneOf(batch[9], {'O', 'F'}); |
| 523 | VerifyAllBetween(batch[10], kStartDate + 1, kEndDate - 151 + 121); |
| 524 | VerifyAllBetween(batch[11], kStartDate + 30, kEndDate - 151 + 90); |
| 525 | VerifyAllBetween(batch[12], kStartDate + 2, kEndDate - 151 + 121 + 30); |
| 526 | VerifyOneOf(batch[13], |
| 527 | /*byte_width=*/25, |
| 528 | { |
| 529 | "DELIVER IN PERSON", |
| 530 | "COLLECT COD", |
| 531 | "NONE", |
| 532 | "TAKE BACK RETURN", |
| 533 | }); |
| 534 | VerifyOneOf(batch[14], |
| 535 | /*byte_width=*/10, |
| 536 | { |
| 537 | "REG AIR", |
| 538 | "AIR", |
| 539 | "RAIL", |
| 540 | "SHIP", |
| 541 | "TRUCK", |
| 542 | "MAIL", |
| 543 | "FOB", |
| 544 | }); |
| 545 | } |
| 546 | for (auto& count : counts) { |
| 547 | ASSERT_GE(count.second, 1); |
| 548 | ASSERT_LE(count.second, 7); |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | TEST(TpchNode, Lineitem) { |
| 553 | ASSERT_OK_AND_ASSIGN(auto res, GenerateTable(&TpchGen::Lineitem)); |
no test coverage detected