| 1555 | |
| 1556 | template <typename BatchesMaker> |
| 1557 | void 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 | |
| 1589 | TEST(AsofJoinTest, BatchSequencing) { |
| 1590 | return TestSequencing(MakeIntegerBatches, /*num_batches=*/1000, /*batch_size=*/1); |
no test coverage detected