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

Function TimedTestExprCompilation

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

Source from the content-addressed store, hash-verified

422}
423
424static void TimedTestExprCompilation(benchmark::State& state) {
425 int64_t iteration = 0;
426 for (auto _ : state) {
427 // schema for input fields
428 auto field0 = field("f0", int64());
429 auto field1 = field("f1", int64());
430 auto literal = TreeExprBuilder::MakeLiteral(iteration);
431 auto schema = arrow::schema({field0, field1});
432
433 // output field
434 auto field_add = field("c1", int64());
435 auto field_less_than = field("c2", boolean());
436
437 // Build expression
438 auto add_func = TreeExprBuilder::MakeFunction(
439 "add", {TreeExprBuilder::MakeField(field0), literal}, int64());
440 auto less_than_func = TreeExprBuilder::MakeFunction(
441 "less_than", {TreeExprBuilder::MakeField(field1), literal}, boolean());
442
443 auto expr_0 = TreeExprBuilder::MakeExpression(add_func, field_add);
444 auto expr_1 = TreeExprBuilder::MakeExpression(less_than_func, field_less_than);
445
446 std::shared_ptr<Projector> projector;
447 ASSERT_OK(Projector::Make(schema, {expr_0, expr_1}, TestConfiguration(), &projector));
448
449 ++iteration;
450 }
451}
452
453static void DecimalAdd2Fast(benchmark::State& state) {
454 // use lesser precision to test the fast-path

Callers

nothing calls this directly

Calls 5

TestConfigurationFunction · 0.85
fieldFunction · 0.50
schemaFunction · 0.50
MakeFunctionFunction · 0.50
MakeFunction · 0.50

Tested by

no test coverage detected