rok commented on a change in pull request #11818:
URL: https://github.com/apache/arrow/pull/11818#discussion_r778163857
##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal_test.cc
##########
@@ -1324,6 +1357,578 @@ TEST_F(ScalarTemporalTest, TestTemporalDifferenceZoned)
{
}
}
+TEST_F(ScalarTemporalTest, TestCeilTemporal) {
+ std::string op = "ceil_temporal";
+ const char* ceil_1_nanosecond =
+ R"(["1970-01-01 00:00:59.123456789", "2000-02-29 23:23:23.999999999",
+ "1899-01-01 00:59:20.001001001", "2033-05-18 03:33:20.000000000",
+ "2020-01-01 01:05:05.001000000", "2019-12-31 02:10:10.002000000",
+ "2019-12-30 03:15:15.003000000", "2009-12-31 04:20:20.004132000",
+ "2010-01-01 05:25:25.005321000", "2010-01-03 06:30:30.006163000",
+ "2010-01-04 07:35:35.000000000", "2006-01-01 08:40:40.000000000",
+ "2005-12-31 09:45:45.000000000", "2008-12-28 00:00:00.000000000",
+ "2008-12-29 00:00:00.000000000", "2012-01-01 01:02:03.000000000",
null])";
+ const char* ceil_1_microsecond =
+ R"(["1970-01-01 00:00:59.123457", "2000-02-29 23:23:24.000000",
+ "1899-01-01 00:59:20.001002", "2033-05-18 03:33:20.000000",
+ "2020-01-01 01:05:05.001000", "2019-12-31 02:10:10.002000",
+ "2019-12-30 03:15:15.003000", "2009-12-31 04:20:20.004132",
+ "2010-01-01 05:25:25.005321", "2010-01-03 06:30:30.006163",
+ "2010-01-04 07:35:35.000000", "2006-01-01 08:40:40.000000",
+ "2005-12-31 09:45:45.000000", "2008-12-28 00:00:00.000000",
+ "2008-12-29 00:00:00.000000", "2012-01-01 01:02:03.000000", null])";
+ const char* ceil_1_millisecond =
+ R"(["1970-01-01 00:00:59.124", "2000-02-29 23:23:24.000",
+ "1899-01-01 00:59:20.002", "2033-05-18 03:33:20.000",
+ "2020-01-01 01:05:05.001", "2019-12-31 02:10:10.002",
+ "2019-12-30 03:15:15.003", "2009-12-31 04:20:20.005",
+ "2010-01-01 05:25:25.006", "2010-01-03 06:30:30.007",
+ "2010-01-04 07:35:35.000", "2006-01-01 08:40:40.000",
+ "2005-12-31 09:45:45.000", "2008-12-28 00:00:00.000",
+ "2008-12-29 00:00:00.000", "2012-01-01 01:02:03.000", null])";
+ const char* ceil_1_second =
+ R"(["1970-01-01 00:01:00", "2000-02-29 23:23:24", "1899-01-01 00:59:21",
+ "2033-05-18 03:33:20", "2020-01-01 01:05:06", "2019-12-31 02:10:11",
+ "2019-12-30 03:15:16", "2009-12-31 04:20:21", "2010-01-01 05:25:26",
+ "2010-01-03 06:30:31", "2010-01-04 07:35:35", "2006-01-01 08:40:40",
+ "2005-12-31 09:45:45", "2008-12-28 00:00:00", "2008-12-29 00:00:00",
+ "2012-01-01 01:02:03", null])";
+ const char* ceil_1_minute =
+ R"(["1970-01-01 00:01:00", "2000-02-29 23:24:00", "1899-01-01 01:00:00",
+ "2033-05-18 03:34:00", "2020-01-01 01:06:00", "2019-12-31 02:11:00",
+ "2019-12-30 03:16:00", "2009-12-31 04:21:00", "2010-01-01 05:26:00",
+ "2010-01-03 06:31:00", "2010-01-04 07:36:00", "2006-01-01 08:41:00",
+ "2005-12-31 09:46:00", "2008-12-28 00:00:00", "2008-12-29 00:00:00",
+ "2012-01-01 01:03:00", null])";
+ const char* ceil_1_hour =
+ R"(["1970-01-01 01:00:00", "2000-03-01 00:00:00", "1899-01-01 01:00:00",
+ "2033-05-18 04:00:00", "2020-01-01 02:00:00", "2019-12-31 03:00:00",
+ "2019-12-30 04:00:00", "2009-12-31 05:00:00", "2010-01-01 06:00:00",
+ "2010-01-03 07:00:00", "2010-01-04 08:00:00", "2006-01-01 09:00:00",
+ "2005-12-31 10:00:00", "2008-12-28 00:00:00", "2008-12-29 00:00:00",
+ "2012-01-01 02:00:00", null])";
+ const char* ceil_1_day =
+ R"(["1970-01-02", "2000-03-01", "1899-01-02", "2033-05-19", "2020-01-02",
+ "2020-01-01", "2019-12-31", "2010-01-01", "2010-01-02", "2010-01-04",
+ "2010-01-05", "2006-01-02", "2006-01-01", "2008-12-28", "2008-12-29",
+ "2012-01-02", null])";
+ const char* ceil_1_weeks =
+ R"(["1970-01-08", "2000-03-02", "1899-01-05", "2033-05-19", "2020-01-02",
+ "2020-01-02", "2020-01-02", "2010-01-07", "2010-01-07", "2010-01-07",
+ "2010-01-07", "2006-01-05", "2006-01-05", "2009-01-01", "2009-01-01",
+ "2012-01-05", null])";
+ const char* ceil_1_months =
+ R"(["1970-02-01", "2000-03-01", "1899-02-01", "2033-06-01", "2020-02-01",
+ "2020-01-01", "2020-01-01", "2010-01-01", "2010-02-01", "2010-02-01",
+ "2010-02-01", "2006-02-01", "2006-01-01", "2009-01-01", "2009-01-01",
+ "2012-02-01", null])";
+ const char* ceil_1_quarters =
+ R"(["1970-04-01", "2000-04-01", "1899-04-01", "2033-07-01", "2020-04-01",
+ "2020-01-01", "2020-01-01", "2010-01-01", "2010-04-01", "2010-04-01",
+ "2010-04-01", "2006-04-01", "2006-01-01", "2009-01-01", "2009-01-01",
+ "2012-04-01", null])";
+ const char* ceil_1_years =
+ R"(["1971-01-01", "2001-01-01", "1900-01-01", "2034-01-01", "2021-01-01",
+ "2020-01-01", "2020-01-01", "2010-01-01", "2011-01-01", "2011-01-01",
+ "2011-01-01", "2007-01-01", "2006-01-01", "2009-01-01", "2009-01-01",
+ "2013-01-01", null])";
+ const char* ceil_15_nanosecond =
+ R"(["1970-01-01 00:00:59.123456790", "2000-02-29 23:23:24.000000000",
+ "1899-01-01 00:59:20.001001005", "2033-05-18 03:33:20.000000010",
+ "2020-01-01 01:05:05.001000000", "2019-12-31 02:10:10.002000000",
+ "2019-12-30 03:15:15.003000000", "2009-12-31 04:20:20.004132000",
+ "2010-01-01 05:25:25.005321000", "2010-01-03 06:30:30.006163005",
+ "2010-01-04 07:35:35.000000010", "2006-01-01 08:40:40.000000005",
+ "2005-12-31 09:45:45.000000000", "2008-12-28 00:00:00.000000000",
+ "2008-12-29 00:00:00.000000000", "2012-01-01 01:02:03.000000000",
null])";
+ const char* ceil_15_microsecond =
+ R"(["1970-01-01 00:00:59.123460", "2000-02-29 23:23:24.000000",
+ "1899-01-01 00:59:20.001015", "2033-05-18 03:33:20.000010",
+ "2020-01-01 01:05:05.001000", "2019-12-31 02:10:10.002000",
+ "2019-12-30 03:15:15.003000", "2009-12-31 04:20:20.004135",
+ "2010-01-01 05:25:25.005330", "2010-01-03 06:30:30.006165",
+ "2010-01-04 07:35:35.000010", "2006-01-01 08:40:40.000005",
+ "2005-12-31 09:45:45.000000", "2008-12-28 00:00:00.000000",
+ "2008-12-29 00:00:00.000000", "2012-01-01 01:02:03.000000", null])";
+ const char* ceil_15_millisecond =
+ R"(["1970-01-01 00:00:59.130", "2000-02-29 23:23:24.000",
+ "1899-01-01 00:59:20.010", "2033-05-18 03:33:20.010",
+ "2020-01-01 01:05:05.010", "2019-12-31 02:10:10.005",
+ "2019-12-30 03:15:15.015", "2009-12-31 04:20:20.010",
+ "2010-01-01 05:25:25.020", "2010-01-03 06:30:30.015",
+ "2010-01-04 07:35:35.010", "2006-01-01 08:40:40.005",
+ "2005-12-31 09:45:45.000", "2008-12-28 00:00:00.000",
+ "2008-12-29 00:00:00.000", "2012-01-01 01:02:03.000", null])";
+ const char* ceil_15_second =
+ R"(["1970-01-01 00:01:00", "2000-02-29 23:23:30", "1899-01-01 00:59:30",
+ "2033-05-18 03:33:30", "2020-01-01 01:05:15", "2019-12-31 02:10:15",
+ "2019-12-30 03:15:30", "2009-12-31 04:20:30", "2010-01-01 05:25:30",
+ "2010-01-03 06:30:45", "2010-01-04 07:35:45", "2006-01-01 08:40:45",
+ "2005-12-31 09:45:45", "2008-12-28 00:00:00", "2008-12-29 00:00:00",
+ "2012-01-01 01:02:15", null])";
+ const char* ceil_15_minute =
+ R"(["1970-01-01 00:15:00", "2000-02-29 23:30:00", "1899-01-01 01:00:00",
+ "2033-05-18 03:45:00", "2020-01-01 01:15:00", "2019-12-31 02:15:00",
+ "2019-12-30 03:30:00", "2009-12-31 04:30:00", "2010-01-01 05:30:00",
+ "2010-01-03 06:45:00", "2010-01-04 07:45:00", "2006-01-01 08:45:00",
+ "2005-12-31 10:00:00", "2008-12-28 00:00:00", "2008-12-29 00:00:00",
+ "2012-01-01 01:15:00", null])";
+ const char* ceil_15_hour =
+ R"(["1970-01-01 15:00:00", "2000-03-01 12:00:00", "1899-01-01 03:00:00",
+ "2033-05-18 18:00:00", "2020-01-01 12:00:00", "2019-12-31 06:00:00",
+ "2019-12-30 15:00:00", "2009-12-31 09:00:00", "2010-01-01 15:00:00",
+ "2010-01-03 12:00:00", "2010-01-04 18:00:00", "2006-01-01 09:00:00",
+ "2005-12-31 18:00:00", "2008-12-28 06:00:00", "2008-12-29 12:00:00",
+ "2012-01-01 15:00:00", null])";
+ const char* ceil_15_day =
+ R"(["1970-01-16", "2000-03-09", "1899-01-13", "2033-05-30", "2020-01-09",
+ "2020-01-09", "2020-01-09", "2010-01-01", "2010-01-16", "2010-01-16",
+ "2010-01-16", "2006-01-07", "2006-01-07", "2009-01-06", "2009-01-06",
+ "2012-01-06", null])";
+ const char* ceil_15_weeks =
+ R"(["1970-04-16", "2000-03-09", "1899-04-13", "2033-07-14", "2020-01-09",
+ "2020-01-09", "2020-01-09", "2010-04-01", "2010-04-01", "2010-04-01",
+ "2010-04-01", "2006-03-23", "2006-03-23", "2009-02-05", "2009-02-05",
+ "2012-04-05", null])";
+ const char* ceil_15_months =
+ R"(["1971-04-01", "2001-04-01", "1900-01-01", "2033-10-01", "2021-04-01",
+ "2020-01-01", "2020-01-01", "2010-01-01", "2011-04-01", "2011-04-01",
+ "2011-04-01", "2006-04-01", "2006-04-01", "2010-01-01", "2010-01-01",
+ "2012-07-01", null])";
+ const char* ceil_15_quarters =
+ R"(["1973-10-01", "2003-10-01", "1902-07-01", "2033-10-01", "2022-07-01",
+ "2022-07-01", "2022-07-01", "2011-04-01", "2011-04-01", "2011-04-01",
+ "2011-04-01", "2007-07-01", "2007-07-01", "2011-04-01", "2011-04-01",
+ "2015-01-01", null])";
+ const char* ceil_15_years =
+ R"(["1980-01-01", "2010-01-01", "1905-01-01", "2040-01-01", "2025-01-01",
+ "2025-01-01", "2025-01-01", "2010-01-01", "2025-01-01", "2025-01-01",
+ "2025-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01",
+ "2025-01-01", null])";
+
+ auto unit = timestamp(TimeUnit::NANO, "UTC");
+// CheckScalarUnary(op, unit, times, unit, ceil_1_nanosecond,
&round_to_1_nanoseconds);
+// CheckScalarUnary(op, unit, times, unit, ceil_1_microsecond,
&round_to_1_microseconds);
+// CheckScalarUnary(op, unit, times, unit, ceil_1_millisecond,
&round_to_1_milliseconds);
+// CheckScalarUnary(op, unit, times, unit, ceil_1_second,
&round_to_1_seconds);
+// CheckScalarUnary(op, unit, times, unit, ceil_1_minute,
&round_to_1_minutes);
+// CheckScalarUnary(op, unit, times, unit, ceil_1_hour, &round_to_1_hours);
+// CheckScalarUnary(op, unit, times, unit, ceil_1_day, &round_to_1_days);
+// CheckScalarUnary(op, unit, times, unit, ceil_1_weeks, &round_to_1_weeks);
Review comment:
Done.
--
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]