@@ -277,6 +277,30 @@ static void TimedTestInExpr(benchmark::State& state) {
277
277
ASSERT_OK (status);
278
278
}
279
279
280
+ static void TimedTestToDate (benchmark::State& state) {
281
+ auto field_a = field (" a" , utf8 ());
282
+ auto schema = arrow::schema ({field_a});
283
+ auto pool = arrow::default_memory_pool ();
284
+
285
+ auto field_result = field (" res" , arrow::date64 ());
286
+
287
+ auto node_a = TreeExprBuilder::MakeField (field_a);
288
+ auto date_pattern = TreeExprBuilder::MakeStringLiteral (" YYYY-MM-DD" );
289
+ auto suppress_literal = TreeExprBuilder::MakeLiteral (1 );
290
+ auto fn = TreeExprBuilder::MakeFunction (" to_date" , {node_a, date_pattern, suppress_literal}, arrow::date64 ());
291
+ auto expr = TreeExprBuilder::MakeExpression (fn, field_result);
292
+
293
+ std::shared_ptr<Projector> projector;
294
+ ASSERT_OK (Projector::Make (schema, {expr}, TestConfiguration (), &projector));
295
+
296
+ Utf8DateDataGenerator data_generator;
297
+ ProjectEvaluator evaluator (projector);
298
+
299
+ Status status = TimedEvaluate<arrow::StringType, std::string>(
300
+ schema, evaluator, data_generator, pool, 1 * MILLION, 16 * THOUSAND, state);
301
+ ASSERT_TRUE (status.ok ());
302
+ }
303
+
280
304
static void DoDecimalAdd3 (benchmark::State& state, int32_t precision, int32_t scale,
281
305
bool large = false ) {
282
306
// schema for input fields
@@ -398,6 +422,7 @@ BENCHMARK(TimedTestFilterLike)->MinTime(1.0)->Unit(benchmark::kMicrosecond);
398
422
BENCHMARK (TimedTestAllocs)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
399
423
BENCHMARK (TimedTestMultiOr)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
400
424
BENCHMARK (TimedTestInExpr)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
425
+ BENCHMARK (TimedTestToDate)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
401
426
BENCHMARK (DecimalAdd2Fast)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
402
427
BENCHMARK (DecimalAdd2LeadingZeroes)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
403
428
BENCHMARK (DecimalAdd2LeadingZeroesWithDiv)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
@@ -406,5 +431,4 @@ BENCHMARK(DecimalAdd3Fast)->MinTime(1.0)->Unit(benchmark::kMicrosecond);
406
431
BENCHMARK (DecimalAdd3LeadingZeroes)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
407
432
BENCHMARK (DecimalAdd3LeadingZeroesWithDiv)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
408
433
BENCHMARK (DecimalAdd3Large)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
409
-
410
434
} // namespace gandiva
0 commit comments