| 391 | } |
| 392 | |
| 393 | static void DoDecimalAdd2(benchmark::State& state, int32_t precision, int32_t scale, |
| 394 | bool large = false) { |
| 395 | // schema for input fields |
| 396 | auto decimal_type = std::make_shared<arrow::Decimal128Type>(precision, scale); |
| 397 | auto field0 = field("f0", decimal_type); |
| 398 | auto field1 = field("f1", decimal_type); |
| 399 | auto schema = arrow::schema({field0, field1}); |
| 400 | |
| 401 | Decimal128TypePtr output_type; |
| 402 | auto status = DecimalTypeUtil::GetResultType( |
| 403 | DecimalTypeUtil::kOpAdd, {decimal_type, decimal_type}, &output_type); |
| 404 | |
| 405 | // output field |
| 406 | auto field_sum = field("add", output_type); |
| 407 | |
| 408 | // Build expression |
| 409 | auto sum = TreeExprBuilder::MakeExpression("add", {field0, field1}, field_sum); |
| 410 | |
| 411 | std::shared_ptr<Projector> projector; |
| 412 | status = Projector::Make(schema, {sum}, TestConfiguration(), &projector); |
| 413 | EXPECT_TRUE(status.ok()); |
| 414 | |
| 415 | Decimal128DataGenerator data_generator(large); |
| 416 | ProjectEvaluator evaluator(projector); |
| 417 | |
| 418 | status = TimedEvaluate<arrow::Decimal128Type, arrow::Decimal128>( |
| 419 | schema, evaluator, data_generator, arrow::default_memory_pool(), 1 * MILLION, |
| 420 | 16 * THOUSAND, state); |
| 421 | ASSERT_OK(status); |
| 422 | } |
| 423 | |
| 424 | static void TimedTestExprCompilation(benchmark::State& state) { |
| 425 | int64_t iteration = 0; |
no test coverage detected