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

Function TEST

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 12

TableSourceNodeOptionsFunction · 0.85
OrderByNodeOptionsFunction · 0.85
OrderingFunction · 0.85
MakeScalarFunction · 0.85
AssertArraysEqualFunction · 0.85
emplace_backMethod · 0.80
TestTableFunction · 0.70
DeclarationClass · 0.70
SortKeyClass · 0.50
num_rowsMethod · 0.45
AppendScalarMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected