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

Function DoDecimalAdd2

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

Source from the content-addressed store, hash-verified

391}
392
393static 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
424static void TimedTestExprCompilation(benchmark::State& state) {
425 int64_t iteration = 0;

Callers 4

DecimalAdd2FastFunction · 0.85
DecimalAdd2LeadingZeroesFunction · 0.85
DecimalAdd2LargeFunction · 0.85

Calls 6

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

Tested by

no test coverage detected