MCPcopy Create free account
hub / github.com/apache/arrow / VerifyLineitem

Function VerifyLineitem

cpp/src/arrow/acero/tpch_node_test.cc:509–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509void 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
552TEST(TpchNode, Lineitem) {
553 ASSERT_OK_AND_ASSIGN(auto res, GenerateTable(&TpchGen::Lineitem));

Callers 1

TESTFunction · 0.85

Calls 5

CountInstancesFunction · 0.85
VerifyAllBetweenFunction · 0.85
VerifyDecimalsBetweenFunction · 0.85
VerifyOneOfFunction · 0.85
ValidateBatchFunction · 0.70

Tested by

no test coverage detected