kou commented on code in PR #14230: URL: https://github.com/apache/arrow/pull/14230#discussion_r979448691
########## cpp/src/gandiva/tests/micro_benchmarks.cc: ########## @@ -249,6 +251,31 @@ static void TimedTestAllocs(benchmark::State& state) { schema, evaluator, data_generator, pool_, 1 * MILLION, 16 * THOUSAND, state); ASSERT_TRUE(status.ok()); } + +static void TimedTestOutputStringAllocs(benchmark::State& state) { + // schema for input fields + auto field_a = field("abcdefghijklmnopqrstuvwxyz", arrow::utf8()); + auto schema = arrow::schema({field_a}); + auto pool_ = arrow::default_memory_pool(); + // output field + auto field_res = field("res", utf8()); + + // Build expression + auto node_a = TreeExprBuilder::MakeField(field_a); + auto upper = TreeExprBuilder::MakeFunction("upper", {node_a}, utf8()); + auto length = TreeExprBuilder::MakeFunction("octet_length", {upper}, int32()); + auto expr = TreeExprBuilder::MakeExpression(upper, field_res); + + std::shared_ptr<Projector> projector; + ASSERT_OK(Projector::Make(schema, {expr}, TestConfiguration(), &projector)); + + FastUtf8DataGenerator data_generator(64); + ProjectEvaluator evaluator(projector); + + auto status = TimedEvaluate<arrow::StringType, std::string>( + schema, evaluator, data_generator, pool_, 1 * MILLION, 16 * THOUSAND, state); + ASSERT_OK(status); Review Comment: Could you use the target expression directly with `ASSERT_OK()` to get better failure message? ```suggestion ASSERT_OK(TimedEvaluate<arrow::StringType, std::string>( schema, evaluator, data_generator, pool_, 1 * MILLION, 16 * THOUSAND, state)); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org