| 254 | } |
| 255 | |
| 256 | static void TimedTestOutputStringAllocs(benchmark::State& state) { |
| 257 | // schema for input fields |
| 258 | auto field_a = field("abcdefghijklmnopqrstuvwxyz", arrow::utf8()); |
| 259 | auto schema = arrow::schema({field_a}); |
| 260 | auto pool_ = arrow::default_memory_pool(); |
| 261 | // output field |
| 262 | auto field_res = field("res", utf8()); |
| 263 | |
| 264 | // Build expression |
| 265 | auto node_a = TreeExprBuilder::MakeField(field_a); |
| 266 | auto upper = TreeExprBuilder::MakeFunction("upper", {node_a}, utf8()); |
| 267 | auto length = TreeExprBuilder::MakeFunction("octet_length", {upper}, int32()); |
| 268 | auto expr = TreeExprBuilder::MakeExpression(upper, field_res); |
| 269 | |
| 270 | std::shared_ptr<Projector> projector; |
| 271 | ASSERT_OK(Projector::Make(schema, {expr}, TestConfiguration(), &projector)); |
| 272 | |
| 273 | FastUtf8DataGenerator data_generator(64); |
| 274 | ProjectEvaluator evaluator(projector); |
| 275 | |
| 276 | ASSERT_OK((TimedEvaluate<arrow::StringType, std::string>( |
| 277 | schema, evaluator, data_generator, pool_, 1 * MILLION, 16 * THOUSAND, state))); |
| 278 | } |
| 279 | // following two tests are for benchmark optimization of |
| 280 | // in expr. will be used in follow-up PRs to optimize in expr. |
| 281 |
nothing calls this directly
no test coverage detected