| 280 | // in expr. will be used in follow-up PRs to optimize in expr. |
| 281 | |
| 282 | static void TimedTestMultiOr(benchmark::State& state) { |
| 283 | // schema for input fields |
| 284 | auto fielda = field("a", utf8()); |
| 285 | auto schema = arrow::schema({fielda}); |
| 286 | auto pool_ = arrow::default_memory_pool(); |
| 287 | |
| 288 | // output fields |
| 289 | auto field_result = field("res", boolean()); |
| 290 | |
| 291 | // build expression. |
| 292 | // booleanOr(a = string1, a = string2, ..) |
| 293 | auto node_a = TreeExprBuilder::MakeField(fielda); |
| 294 | |
| 295 | NodeVector boolean_functions; |
| 296 | FastUtf8DataGenerator data_generator1(250); |
| 297 | for (int thresh = 1; thresh <= 32; thresh++) { |
| 298 | auto literal = TreeExprBuilder::MakeStringLiteral(data_generator1.GenerateData()); |
| 299 | auto condition = TreeExprBuilder::MakeFunction("equal", {node_a, literal}, boolean()); |
| 300 | boolean_functions.push_back(condition); |
| 301 | } |
| 302 | |
| 303 | auto boolean_or = TreeExprBuilder::MakeOr(boolean_functions); |
| 304 | auto expr = TreeExprBuilder::MakeExpression(boolean_or, field_result); |
| 305 | |
| 306 | // Build a projector for the expressions. |
| 307 | std::shared_ptr<Projector> projector; |
| 308 | ASSERT_OK(Projector::Make(schema, {expr}, TestConfiguration(), &projector)); |
| 309 | |
| 310 | FastUtf8DataGenerator data_generator(250); |
| 311 | ProjectEvaluator evaluator(projector); |
| 312 | Status status = TimedEvaluate<arrow::StringType, std::string>( |
| 313 | schema, evaluator, data_generator, pool_, 100 * THOUSAND, 16 * THOUSAND, state); |
| 314 | ASSERT_OK(status); |
| 315 | } |
| 316 | |
| 317 | static void TimedTestInExpr(benchmark::State& state) { |
| 318 | // schema for input fields |
nothing calls this directly
no test coverage detected