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

Function TEST

cpp/src/arrow/acero/test_nodes_test.cc:30–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace acero {
29
30TEST(JitterNode, Basic) {
31 static constexpr random::SeedType kTestSeed = 42;
32 static constexpr int kMaxJitterMod = 4;
33 static constexpr int kNumBatches = 256;
34 RegisterTestNodes();
35 std::shared_ptr<Table> input =
36 gen::Gen({gen::Constant(std::make_shared<Int32Scalar>(0))})
37 ->FailOnError()
38 ->Table(1, kNumBatches);
39 Declaration plan =
40 Declaration::Sequence({{"table_source", TableSourceNodeOptions(input)},
41 {"jitter", JitterNodeOptions(kTestSeed, kMaxJitterMod)}});
42 QueryOptions query_options;
43 query_options.sequence_output = false;
44 ASSERT_OK_AND_ASSIGN(BatchesWithCommonSchema batches_and_schema,
45 DeclarationToExecBatches(std::move(plan), query_options));
46
47 ASSERT_EQ(kNumBatches, static_cast<int>(batches_and_schema.batches.size()));
48 int numOutOfPlace = 0;
49 for (int idx = 0; idx < kNumBatches; idx++) {
50 const ExecBatch& batch = batches_and_schema.batches[idx];
51 int jitter = std::abs(idx - static_cast<int>(batch.index));
52 if (jitter > 0) {
53 numOutOfPlace++;
54 }
55 }
56 ASSERT_GT(numOutOfPlace, 0);
57}
58
59} // namespace acero
60} // namespace arrow

Callers

nothing calls this directly

Calls 8

RegisterTestNodesFunction · 0.85
ConstantFunction · 0.85
TableSourceNodeOptionsFunction · 0.85
JitterNodeOptionsClass · 0.85
FailOnErrorMethod · 0.80
GenFunction · 0.50
TableMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected