MCPcopy Create free account
hub / github.com/apache/arrow / TEST_F

Function TEST_F

cpp/src/arrow/compute/kernels/scalar_temporal_test.cc:532–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530};
531
532TEST_F(ScalarTemporalTest, TestTemporalComponentExtractionAllTemporalTypes) {
533 std::vector<std::shared_ptr<DataType>> units = {date32(), date64(),
534 timestamp(TimeUnit::NANO)};
535 std::vector<const char*> samples = {date32s, date64s, times};
536 DCHECK_EQ(units.size(), samples.size());
537 for (size_t i = 0; i < samples.size(); ++i) {
538 auto unit = units[i];
539 auto sample = samples[i];
540 CheckScalarUnary("year", unit, sample, int64(), year);
541 CheckScalarUnary("is_leap_year", unit, sample, boolean(), is_leap_year);
542 CheckScalarUnary("month", unit, sample, int64(), month);
543 CheckScalarUnary("day", unit, sample, int64(), day);
544 CheckScalarUnary("year_month_day", ArrayFromJSON(unit, sample), year_month_day);
545 CheckScalarUnary("day_of_week", unit, sample, int64(), day_of_week);
546 CheckScalarUnary("day_of_year", unit, sample, int64(), day_of_year);
547 CheckScalarUnary("us_year", unit, sample, int64(), us_year);
548 CheckScalarUnary("iso_year", unit, sample, int64(), iso_year);
549 CheckScalarUnary("iso_week", unit, sample, int64(), iso_week);
550 CheckScalarUnary("us_week", unit, sample, int64(), us_week);
551 CheckScalarUnary("iso_calendar", ArrayFromJSON(unit, sample), iso_calendar);
552 CheckScalarUnary("quarter", unit, sample, int64(), quarter);
553 if (unit->id() == Type::TIMESTAMP) {
554 CheckScalarUnary("hour", unit, sample, int64(), hour);
555 CheckScalarUnary("minute", unit, sample, int64(), minute);
556 CheckScalarUnary("second", unit, sample, int64(), second);
557 CheckScalarUnary("millisecond", unit, sample, int64(), millisecond);
558 CheckScalarUnary("microsecond", unit, sample, int64(), microsecond);
559 CheckScalarUnary("nanosecond", unit, sample, int64(), nanosecond);
560 CheckScalarUnary("subsecond", unit, sample, float64(), subsecond);
561 }
562 }
563
564 CheckScalarUnary("hour", time32(TimeUnit::SECOND), times_s, int64(), hour);
565 CheckScalarUnary("minute", time32(TimeUnit::SECOND), times_s, int64(), minute);
566 CheckScalarUnary("second", time32(TimeUnit::SECOND), times_s, int64(), second);
567 CheckScalarUnary("millisecond", time32(TimeUnit::SECOND), times_s, int64(), zeros);
568 CheckScalarUnary("microsecond", time32(TimeUnit::SECOND), times_s, int64(), zeros);
569 CheckScalarUnary("nanosecond", time32(TimeUnit::SECOND), times_s, int64(), zeros);
570 CheckScalarUnary("subsecond", time32(TimeUnit::SECOND), times_s, float64(), zeros);
571
572 CheckScalarUnary("hour", time32(TimeUnit::MILLI), times_ms, int64(), hour);
573 CheckScalarUnary("minute", time32(TimeUnit::MILLI), times_ms, int64(), minute);
574 CheckScalarUnary("second", time32(TimeUnit::MILLI), times_ms, int64(), second);
575 CheckScalarUnary("millisecond", time32(TimeUnit::MILLI), times_ms, int64(),
576 millisecond);
577 CheckScalarUnary("microsecond", time32(TimeUnit::MILLI), times_ms, int64(), zeros);
578 CheckScalarUnary("nanosecond", time32(TimeUnit::MILLI), times_ms, int64(), zeros);
579 CheckScalarUnary("subsecond", time32(TimeUnit::MILLI), times_ms, float64(),
580 subsecond_ms);
581
582 CheckScalarUnary("hour", time64(TimeUnit::MICRO), times_us, int64(), hour);
583 CheckScalarUnary("minute", time64(TimeUnit::MICRO), times_us, int64(), minute);
584 CheckScalarUnary("second", time64(TimeUnit::MICRO), times_us, int64(), second);
585 CheckScalarUnary("millisecond", time64(TimeUnit::MICRO), times_us, int64(),
586 millisecond);
587 CheckScalarUnary("microsecond", time64(TimeUnit::MICRO), times_us, int64(),
588 microsecond);
589 CheckScalarUnary("nanosecond", time64(TimeUnit::MICRO), times_us, int64(), zeros);

Callers

nothing calls this directly

Calls 15

CheckScalarUnaryFunction · 0.85
ArrayFromJSONFunction · 0.85
IsDaylightSavingsClass · 0.85
WrapFunction · 0.85
FromStringFunction · 0.85
YearClass · 0.85
MonthClass · 0.85
DayClass · 0.85
YearMonthDayClass · 0.85
DayOfYearClass · 0.85
USYearClass · 0.85
ISOYearClass · 0.85

Tested by

no test coverage detected