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

Function TimedTestBigNested

cpp/src/gandiva/tests/micro_benchmarks.cc:69–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static void TimedTestBigNested(benchmark::State& state) {
70 // schema for input fields
71 auto fielda = field("a", int32());
72 auto schema = arrow::schema({fielda});
73 auto pool_ = arrow::default_memory_pool();
74
75 // output fields
76 auto field_result = field("res", int32());
77
78 // build expression.
79 // if (a < 10)
80 // 10
81 // else if (a < 20)
82 // 20
83 // ..
84 // ..
85 // else if (a < 190)
86 // 190
87 // else
88 // 200
89 auto node_a = TreeExprBuilder::MakeField(fielda);
90 auto top_node = TreeExprBuilder::MakeLiteral(200);
91 for (int thresh = 190; thresh > 0; thresh -= 10) {
92 auto literal = TreeExprBuilder::MakeLiteral(thresh);
93 auto condition =
94 TreeExprBuilder::MakeFunction("less_than", {node_a, literal}, boolean());
95 auto if_node = TreeExprBuilder::MakeIf(condition, literal, top_node, int32());
96 top_node = if_node;
97 }
98 auto expr = TreeExprBuilder::MakeExpression(top_node, field_result);
99
100 // Build a projector for the expressions.
101 std::shared_ptr<Projector> projector;
102 ASSERT_OK(Projector::Make(schema, {expr}, TestConfiguration(), &projector));
103
104 BoundedInt32DataGenerator data_generator(250);
105 ProjectEvaluator evaluator(projector);
106
107 Status status = TimedEvaluate<arrow::Int32Type, int32_t>(
108 schema, evaluator, data_generator, pool_, 1 * MILLION, 16 * THOUSAND, state);
109 ASSERT_TRUE(status.ok());
110}
111
112static void TimedTestExtractYear(benchmark::State& state) {
113 // schema for input fields

Callers

nothing calls this directly

Calls 7

default_memory_poolFunction · 0.85
TestConfigurationFunction · 0.85
fieldFunction · 0.50
schemaFunction · 0.50
MakeFunctionFunction · 0.50
MakeFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected