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

Function TestSequencing

cpp/src/arrow/acero/asof_join_node_test.cc:1557–1587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1555
1556template <typename BatchesMaker>
1557void TestSequencing(BatchesMaker maker, int num_batches, int batch_size) {
1558 auto l_schema =
1559 schema({field("time", int32()), field("key", int32()), field("l_value", int32())});
1560 auto r_schema =
1561 schema({field("time", int32()), field("key", int32()), field("r0_value", int32())});
1562
1563 auto make_shift = [&maker, num_batches, batch_size](
1564 const std::shared_ptr<Schema>& schema, int shift) {
1565 return maker({[](int row) -> int64_t { return row; },
1566 [num_batches](int row) -> int64_t { return row / num_batches; },
1567 [shift](int row) -> int64_t { return row * 10 + shift; }},
1568 schema, num_batches, batch_size);
1569 };
1570 ASSERT_OK_AND_ASSIGN(auto l_batches, make_shift(l_schema, 0));
1571 ASSERT_OK_AND_ASSIGN(auto r_batches, make_shift(r_schema, 1));
1572
1573 Declaration l_src = {"source",
1574 SourceNodeOptions(l_schema, l_batches.gen(false, false))};
1575 Declaration r_src = {"source",
1576 SourceNodeOptions(r_schema, r_batches.gen(false, false))};
1577
1578 Declaration asofjoin = {
1579 "asofjoin", {l_src, r_src}, GetRepeatedOptions(2, "time", {"key"}, 1000)};
1580
1581 QueryOptions query_options;
1582 query_options.use_threads = true;
1583 ASSERT_OK_AND_ASSIGN(BatchesWithCommonSchema batches,
1584 DeclarationToExecBatches(asofjoin, query_options));
1585
1586 AssertExecBatchesSequenced(batches.batches);
1587}
1588
1589TEST(AsofJoinTest, BatchSequencing) {
1590 return TestSequencing(MakeIntegerBatches, /*num_batches=*/1000, /*batch_size=*/1);

Callers 1

TESTFunction · 0.85

Calls 6

SourceNodeOptionsClass · 0.85
GetRepeatedOptionsFunction · 0.70
schemaFunction · 0.50
fieldFunction · 0.50
genMethod · 0.45

Tested by

no test coverage detected