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

Function TEST

cpp/src/arrow/acero/sorted_merge_node_test.cc:50–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50TEST(SortedMergeNode, Basic) {
51 auto table1 = TestTable(
52 /*start=*/0,
53 /*step=*/2,
54 /*rows_per_batch=*/2,
55 /*num_batches=*/3);
56 auto table2 = TestTable(
57 /*start=*/1,
58 /*step=*/2,
59 /*rows_per_batch=*/3,
60 /*num_batches=*/2);
61 auto table3 = TestTable(
62 /*start=*/3,
63 /*step=*/3,
64 /*rows_per_batch=*/6,
65 /*num_batches=*/1);
66 std::vector<Declaration::Input> src_decls;
67 src_decls.emplace_back(Declaration("table_source", TableSourceNodeOptions(table1)));
68 src_decls.emplace_back(Declaration("table_source", TableSourceNodeOptions(table2)));
69 src_decls.emplace_back(Declaration("table_source", TableSourceNodeOptions(table3)));
70
71 auto ops = OrderByNodeOptions(compute::Ordering({compute::SortKey("timestamp")}));
72
73 Declaration sorted_merge{"sorted_merge", src_decls, ops};
74 // We can't use threads for sorted merging since it relies on
75 // ascending deterministic order of timestamps
76 ASSERT_OK_AND_ASSIGN(auto output,
77 DeclarationToTable(sorted_merge, /*use_threads=*/false));
78 ASSERT_EQ(output->num_rows(), 18);
79
80 ASSERT_OK_AND_ASSIGN(auto expected_ts_builder,
81 MakeBuilder(int32(), default_memory_pool()));
82 for (auto i : {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 15, 18}) {
83 ASSERT_OK(expected_ts_builder->AppendScalar(*MakeScalar(i)));
84 }
85 ASSERT_OK_AND_ASSIGN(auto expected_ts, expected_ts_builder->Finish());
86 auto output_col = output->column(0);
87 ASSERT_OK_AND_ASSIGN(auto output_ts, Concatenate(output_col->chunks()));
88
89 AssertArraysEqual(*expected_ts, *output_ts);
90}
91
92TEST(SortedMergeNode, TestSortedMergeTwoInputsWithBool) {
93 const int64_t row_count = (16 << 10); // 16k rows per input

Callers

nothing calls this directly

Calls 15

TableSourceNodeOptionsFunction · 0.85
OrderByNodeOptionsFunction · 0.85
OrderingFunction · 0.85
MakeScalarFunction · 0.85
AssertArraysEqualFunction · 0.85
emplace_backMethod · 0.80
push_backMethod · 0.80
GetColumnByNameMethod · 0.80
TestTableFunction · 0.70
DeclarationClass · 0.70
SortKeyClass · 0.50
schemaFunction · 0.50

Tested by

no test coverage detected