@@ -277,6 +277,31 @@ 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 (
291
+ " to_date" , {node_a, date_pattern, suppress_literal}, arrow::date64 ());
292
+ auto expr = TreeExprBuilder::MakeExpression (fn, field_result);
293
+
294
+ std::shared_ptr<Projector> projector;
295
+ ASSERT_OK (Projector::Make (schema, {expr}, TestConfiguration (), &projector));
296
+
297
+ Utf8DateDataGenerator data_generator;
298
+ ProjectEvaluator evaluator (projector);
299
+
300
+ Status status = TimedEvaluate<arrow::StringType, std::string>(
301
+ schema, evaluator, data_generator, pool, 1 * MILLION, 16 * THOUSAND, state);
302
+ ASSERT_TRUE (status.ok ());
303
+ }
304
+
280
305
static void DoDecimalAdd3 (benchmark::State& state, int32_t precision, int32_t scale,
281
306
bool large = false ) {
282
307
// schema for input fields
@@ -398,6 +423,7 @@ BENCHMARK(TimedTestFilterLike)->MinTime(1.0)->Unit(benchmark::kMicrosecond);
398
423
BENCHMARK (TimedTestAllocs)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
399
424
BENCHMARK (TimedTestMultiOr)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
400
425
BENCHMARK (TimedTestInExpr)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
426
+ BENCHMARK (TimedTestToDate)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
401
427
BENCHMARK (DecimalAdd2Fast)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
402
428
BENCHMARK (DecimalAdd2LeadingZeroes)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
403
429
BENCHMARK (DecimalAdd2LeadingZeroesWithDiv)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
@@ -406,5 +432,4 @@ BENCHMARK(DecimalAdd3Fast)->MinTime(1.0)->Unit(benchmark::kMicrosecond);
406
432
BENCHMARK (DecimalAdd3LeadingZeroes)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
407
433
BENCHMARK (DecimalAdd3LeadingZeroesWithDiv)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
408
434
BENCHMARK (DecimalAdd3Large)->MinTime (1.0 )->Unit(benchmark::kMicrosecond );
409
-
410
435
} // namespace gandiva
0 commit comments