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

Function TimedTestMultiOr

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

Source from the content-addressed store, hash-verified

280// in expr. will be used in follow-up PRs to optimize in expr.
281
282static void TimedTestMultiOr(benchmark::State& state) {
283 // schema for input fields
284 auto fielda = field("a", utf8());
285 auto schema = arrow::schema({fielda});
286 auto pool_ = arrow::default_memory_pool();
287
288 // output fields
289 auto field_result = field("res", boolean());
290
291 // build expression.
292 // booleanOr(a = string1, a = string2, ..)
293 auto node_a = TreeExprBuilder::MakeField(fielda);
294
295 NodeVector boolean_functions;
296 FastUtf8DataGenerator data_generator1(250);
297 for (int thresh = 1; thresh <= 32; thresh++) {
298 auto literal = TreeExprBuilder::MakeStringLiteral(data_generator1.GenerateData());
299 auto condition = TreeExprBuilder::MakeFunction("equal", {node_a, literal}, boolean());
300 boolean_functions.push_back(condition);
301 }
302
303 auto boolean_or = TreeExprBuilder::MakeOr(boolean_functions);
304 auto expr = TreeExprBuilder::MakeExpression(boolean_or, field_result);
305
306 // Build a projector for the expressions.
307 std::shared_ptr<Projector> projector;
308 ASSERT_OK(Projector::Make(schema, {expr}, TestConfiguration(), &projector));
309
310 FastUtf8DataGenerator data_generator(250);
311 ProjectEvaluator evaluator(projector);
312 Status status = TimedEvaluate<arrow::StringType, std::string>(
313 schema, evaluator, data_generator, pool_, 100 * THOUSAND, 16 * THOUSAND, state);
314 ASSERT_OK(status);
315}
316
317static void TimedTestInExpr(benchmark::State& state) {
318 // schema for input fields

Callers

nothing calls this directly

Calls 8

default_memory_poolFunction · 0.85
TestConfigurationFunction · 0.85
push_backMethod · 0.80
fieldFunction · 0.50
schemaFunction · 0.50
MakeFunctionFunction · 0.50
MakeFunction · 0.50
GenerateDataMethod · 0.45

Tested by

no test coverage detected