cpp/src/gandiva/tests/micro_benchmarks.cc
// following two tests are for benchmark optimization of
// in expr. will be used in follow-up PRs to optimize in expr.
following two tests are for benchmark optimization of
in expr. will be used in follow-up PRs to optimize in expr.
following two tests are for benchmark optimization of in expr . will be used in follow - up PRs to optimize in expr .
static void TimedTestMultiOr(benchmark::State& state) {
  auto fielda = field("a", utf8());
  auto schema = arrow::schema({fielda});
  auto pool_ = arrow::default_memory_pool();
  auto field_result = field("res", boolean());
  auto node_a = TreeExprBuilder::MakeField(fielda);
  NodeVector boolean_functions;
  FastUtf8DataGenerator data_generator1(250);
  for (int thresh = 1; thresh <= 32; thresh++) {
    auto literal = TreeExprBuilder::MakeStringLiteral(data_generator1.GenerateData());
    auto condition = TreeExprBuilder::MakeFunction("equal", {node_a, literal}, boolean());
    boolean_functions.push_back(condition);
  }
  auto boolean_or = TreeExprBuilder::MakeOr(boolean_functions);
  auto expr = TreeExprBuilder::MakeExpression(boolean_or, field_result);
  std::shared_ptr<Projector> projector;
  ASSERT_OK(Projector::Make(schema, {expr}, TestConfiguration(), &projector));
  FastUtf8DataGenerator data_generator(250);
  ProjectEvaluator evaluator(projector);
  Status status = TimedEvaluate<arrow::StringType, std::string>(
      schema, evaluator, data_generator, pool_, 100 * THOUSAND, 16 * THOUSAND, state);
  ASSERT_OK(status);
}
static void TimedTestMultiOr ( benchmark :: State & state ) { auto fielda = field ( " " , utf8 ( ) ) ; auto schema = arrow :: schema ( { fielda } ) ; auto pool_ = arrow :: default_memory_pool ( ) ; auto field_result = field ( " " , boolean ( ) ) ; auto node_a = TreeExprBuilder :: MakeField ( fielda ) ; NodeVector boolean_functions ; FastUtf8DataGenerator data_generator1 ( 250 ) ; for ( int thresh = 1 ; thresh <= 32 ; thresh ++ ) { auto literal = TreeExprBuilder :: MakeStringLiteral ( data_generator1 . GenerateData ( ) ) ; auto condition = TreeExprBuilder :: MakeFunction ( " " , { node_a , literal } , boolean ( ) ) ; boolean_functions . push_back ( condition ) ; } auto boolean_or = TreeExprBuilder :: MakeOr ( boolean_functions ) ; auto expr = TreeExprBuilder :: MakeExpression ( boolean_or , field_result ) ; std :: shared_ptr < Projector > projector ; ASSERT_OK ( Projector :: Make ( schema , { expr } , TestConfiguration ( ) , & projector ) ) ; FastUtf8DataGenerator data_generator ( 250 ) ; ProjectEvaluator evaluator ( projector ) ; Status status = TimedEvaluate < arrow :: StringType , std :: string > ( schema , evaluator , data_generator , pool_ , 100 * THOUSAND , 16 * THOUSAND , state ) ; ASSERT_OK ( status ) ; }
following two tests are for benchmark optimization of
in expr.
following two tests are for benchmark optimization of in expr .
// schema for input fields // output fields // build expression. // booleanOr(a = string1, a = string2, ..) // Build a projector for the expressions.