From 4bc76dfdb4fbedbd2f35ccb99baf89fafef78a35 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 18 Dec 2022 06:20:56 +0100 Subject: [PATCH] Add a test for #36038 --- .../02504_parse_datetime_best_effort_calebeaires.reference | 1 + .../02504_parse_datetime_best_effort_calebeaires.sql | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 tests/queries/0_stateless/02504_parse_datetime_best_effort_calebeaires.reference create mode 100644 tests/queries/0_stateless/02504_parse_datetime_best_effort_calebeaires.sql diff --git a/tests/queries/0_stateless/02504_parse_datetime_best_effort_calebeaires.reference b/tests/queries/0_stateless/02504_parse_datetime_best_effort_calebeaires.reference new file mode 100644 index 00000000000..f5420eeb6ba --- /dev/null +++ b/tests/queries/0_stateless/02504_parse_datetime_best_effort_calebeaires.reference @@ -0,0 +1 @@ +('Date','2148-06-07') ('Date32','1969-01-01') ('DateTime','2105-02-07 17:10:16') ('DateTime','2105-02-07 17:10:16') ('DateTime64(3)','1969-01-01 10:42:00.000') diff --git a/tests/queries/0_stateless/02504_parse_datetime_best_effort_calebeaires.sql b/tests/queries/0_stateless/02504_parse_datetime_best_effort_calebeaires.sql new file mode 100644 index 00000000000..74b974d7440 --- /dev/null +++ b/tests/queries/0_stateless/02504_parse_datetime_best_effort_calebeaires.sql @@ -0,0 +1,5 @@ +CREATE TEMPORARY TABLE my_table (col_date Date, col_date32 Date32, col_datetime DateTime, col_datetime32 DateTime32, col_datetime64 DateTime64); +insert into `my_table` (`col_date`, `col_date32`, `col_datetime`, `col_datetime32`, `col_datetime64`) values (parseDateTime64BestEffort('1969-01-01'), '1969-01-01', parseDateTime64BestEffort('1969-01-01 10:42:00'), parseDateTime64BestEffort('1969-01-01 10:42:00'), parseDateTime64BestEffort('1969-01-01 10:42:00')); + +-- The values for Date32 and DateTime64 will be year 1969, while the values of Date, DateTime will contain a value affected by implementation-defined overflow and can be arbitrary. +SELECT * APPLY(x -> (toTypeName(x), x)) FROM my_table;