js8544 commented on code in PR #14230:
URL: https://github.com/apache/arrow/pull/14230#discussion_r979522804
##########
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:
I tried this but it doesn't compile.
```
/home/jinshang/arrow/cpp/src/gandiva/tests/micro_benchmarks.cc:312:138:
error: macro "ASSERT_OK" passed 2 arguments, but takes just 1
312 | ASSERT_OK(TimedEvaluate<arrow::StringType, std::string>(schema,
evaluator, data_generator, pool_, 100 * THOUSAND, 16 * THOUSAND, state));
|
^
In file included from
/home/jinshang/arrow/cpp/src/gandiva/tests/micro_benchmarks.cc:21:
/home/jinshang/arrow/cpp/src/arrow/testing/gtest_util.h:87: note: macro
"ASSERT_OK" defined here
87 | #define ASSERT_OK(expr)
\
|
/home/jinshang/arrow/cpp/src/gandiva/tests/micro_benchmarks.cc: In function
‘void gandiva::TimedTestMultiOr(benchmark::State&)’:
/home/jinshang/arrow/cpp/src/gandiva/tests/micro_benchmarks.cc:312:3: error:
‘ASSERT_OK’ was not declared in this scope
312 | ASSERT_OK(TimedEvaluate<arrow::StringType, std::string>(schema,
evaluator, data_generator, pool_, 100 * THOUSAND, 16 * THOUSAND, state));
```
Seems to be linked to this:
https://stackoverflow.com/questions/32241581/c-preprocessors-are-not-aware-of-template-arguments
So I wrapped an additional pair of parentheses and it works now.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]