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

Function CheckFetch

cpp/src/arrow/acero/fetch_node_test.cc:40–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void CheckFetch(FetchNodeOptions options) {
41 constexpr random::SeedType kSeed = 42;
42 constexpr int kJitterMod = 4;
43 RegisterTestNodes();
44 std::shared_ptr<Table> input = TestTable();
45 Declaration plan =
46 Declaration::Sequence({{"table_source", TableSourceNodeOptions(input)},
47 {"jitter", JitterNodeOptions(kSeed, kJitterMod)},
48 {"fetch", options}});
49 for (bool use_threads : {false, true}) {
50 QueryOptions query_options;
51 query_options.use_threads = use_threads;
52 ASSERT_OK_AND_ASSIGN(std::shared_ptr<Table> actual,
53 DeclarationToTable(plan, query_options));
54
55 if (options.offset >= input->num_rows() || options.count == 0) {
56 // In these cases, Table::Slice would fail or give us a table with 1 chunk while
57 // the fetch node gives us a table with 0 chunks
58 ASSERT_EQ(0, actual->num_rows());
59 } else {
60 std::shared_ptr<Table> expected = input->Slice(options.offset, options.count);
61 AssertTablesEqual(*expected, *actual);
62 }
63 }
64}
65
66void CheckFetchInvalid(FetchNodeOptions options, const std::string& message) {
67 std::shared_ptr<Table> input = TestTable();

Callers 1

TESTFunction · 0.85

Calls 9

RegisterTestNodesFunction · 0.85
TableSourceNodeOptionsFunction · 0.85
JitterNodeOptionsClass · 0.85
DeclarationToTableFunction · 0.85
AssertTablesEqualFunction · 0.85
TestTableFunction · 0.70
ASSERT_OK_AND_ASSIGNFunction · 0.70
num_rowsMethod · 0.45
SliceMethod · 0.45

Tested by

no test coverage detected