From a43c4d3f9f5e0e7b946a0e16fde5f119c8f30a28 Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Thu, 5 Sep 2024 12:13:41 +0800 Subject: [PATCH 1/5] fix getArgumentsThatAreAlwaysConstant in toDateTime64 --- src/Functions/FunctionsConversion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Functions/FunctionsConversion.cpp b/src/Functions/FunctionsConversion.cpp index 0f3ffbffdff..7691be900d3 100644 --- a/src/Functions/FunctionsConversion.cpp +++ b/src/Functions/FunctionsConversion.cpp @@ -2147,7 +2147,7 @@ public: if constexpr (std::is_same_v) return {}; else if constexpr (std::is_same_v) - return {2}; + return {1, 2}; return {1}; } bool canBeExecutedOnDefaultArguments() const override { return false; } From b19175d5d0e285f0420683069a5b865095b05f92 Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Thu, 5 Sep 2024 15:35:45 +0800 Subject: [PATCH 2/5] fix failed uts --- .../03150_dynamic_type_mv_insert.reference | 16 ++++++++-------- .../03151_dynamic_type_scale_max_types.reference | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/queries/0_stateless/03150_dynamic_type_mv_insert.reference b/tests/queries/0_stateless/03150_dynamic_type_mv_insert.reference index 370e6352657..ad3fe1432e2 100644 --- a/tests/queries/0_stateless/03150_dynamic_type_mv_insert.reference +++ b/tests/queries/0_stateless/03150_dynamic_type_mv_insert.reference @@ -1,12 +1,12 @@ 1 2024-01-01 Date -2 1704056400 Decimal(18, 3) +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') 3 1 Float32 4 2 Float64 1 2024-01-01 Date 1 2024-01-01 Date -2 1704056400 Decimal(18, 3) -2 1704056400 Decimal(18, 3) +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') 3 1 Float32 3 1 Float32 4 2 Float64 @@ -14,8 +14,8 @@ 1 2024-01-01 Date 1 2024-01-01 Date -2 1704056400 Decimal(18, 3) -2 1704056400 Decimal(18, 3) +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') 3 1 Float32 3 1 Float32 4 2 Float64 @@ -24,9 +24,9 @@ 1 2024-01-01 Date 1 2024-01-01 Date 1 2024-01-01 Date -2 1704056400 Decimal(18, 3) -2 1704056400 Decimal(18, 3) -2 1704056400 Decimal(18, 3) +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') 3 1 Float32 3 1 Float32 3 1 Float32 diff --git a/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.reference b/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.reference index 2d3b2f118f6..17f77dfe299 100644 --- a/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.reference +++ b/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.reference @@ -1,12 +1,12 @@ 1 2024-01-01 Date false -2 1704056400 Decimal(18, 3) false +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') false 3 1 Float32 true 4 2 Float64 true 1 2024-01-01 Date false 1 2024-01-01 Date false -2 1704056400 Decimal(18, 3) false -2 1704056400 Decimal(18, 3) false +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') false +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') false 3 1 Float32 false 3 1 Float32 false 4 2 Float64 false @@ -15,9 +15,9 @@ 1 2024-01-01 Date true 1 2024-01-01 Date true 1 2024-01-01 Date true -2 1704056400 Decimal(18, 3) true -2 1704056400 Decimal(18, 3) true -2 1704056400 Decimal(18, 3) true +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') true +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') true +2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') true 3 1 Float32 true 3 1 Float32 true 3 1 Float32 true From 71f609e67db9d30054d84c4af2c129414f7b422b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=89=AC?= <654010905@qq.com> Date: Tue, 19 Nov 2024 12:21:26 +0800 Subject: [PATCH 3/5] Update 03150_dynamic_type_mv_insert.sql --- tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql b/tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql index 71d5dd4abd1..558da90430e 100644 --- a/tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql +++ b/tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql @@ -1,4 +1,5 @@ SET allow_experimental_dynamic_type=1; +SET session_timezone = 'UTC'; DROP TABLE IF EXISTS null_table; CREATE TABLE null_table From 97aefe668ef0d1dab08231bd1ad183ea9fdbc613 Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Thu, 21 Nov 2024 09:38:52 +0800 Subject: [PATCH 4/5] fix style --- .../03150_dynamic_type_mv_insert.reference | 16 ++++++++-------- .../0_stateless/03150_dynamic_type_mv_insert.sql | 6 +++--- .../03151_dynamic_type_scale_max_types.reference | 12 ++++++------ .../03151_dynamic_type_scale_max_types.sql | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/queries/0_stateless/03150_dynamic_type_mv_insert.reference b/tests/queries/0_stateless/03150_dynamic_type_mv_insert.reference index ad3fe1432e2..370e6352657 100644 --- a/tests/queries/0_stateless/03150_dynamic_type_mv_insert.reference +++ b/tests/queries/0_stateless/03150_dynamic_type_mv_insert.reference @@ -1,12 +1,12 @@ 1 2024-01-01 Date -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') +2 1704056400 Decimal(18, 3) 3 1 Float32 4 2 Float64 1 2024-01-01 Date 1 2024-01-01 Date -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') +2 1704056400 Decimal(18, 3) +2 1704056400 Decimal(18, 3) 3 1 Float32 3 1 Float32 4 2 Float64 @@ -14,8 +14,8 @@ 1 2024-01-01 Date 1 2024-01-01 Date -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') +2 1704056400 Decimal(18, 3) +2 1704056400 Decimal(18, 3) 3 1 Float32 3 1 Float32 4 2 Float64 @@ -24,9 +24,9 @@ 1 2024-01-01 Date 1 2024-01-01 Date 1 2024-01-01 Date -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') +2 1704056400 Decimal(18, 3) +2 1704056400 Decimal(18, 3) +2 1704056400 Decimal(18, 3) 3 1 Float32 3 1 Float32 3 1 Float32 diff --git a/tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql b/tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql index 71d5dd4abd1..41b77661e85 100644 --- a/tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql +++ b/tests/queries/0_stateless/03150_dynamic_type_mv_insert.sql @@ -20,11 +20,11 @@ CREATE TABLE to_table ) ENGINE = MergeTree ORDER BY n1; -INSERT INTO null_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3, 'Asia/Istanbul')), (3, toFloat32(1)), (4, toFloat64(2)); +INSERT INTO null_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3)), (3, toFloat32(1)), (4, toFloat64(2)); SELECT *, dynamicType(n2) FROM to_table ORDER BY ALL; select ''; -INSERT INTO null_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3, 'Asia/Istanbul')), (3, toFloat32(1)), (4, toFloat64(2)); +INSERT INTO null_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3)), (3, toFloat32(1)), (4, toFloat64(2)); SELECT *, dynamicType(n2) FROM to_table ORDER BY ALL; select ''; @@ -33,7 +33,7 @@ SELECT *, dynamicType(n2) FROM to_table ORDER BY ALL; select ''; ALTER TABLE to_table MODIFY COLUMN n2 Dynamic(max_types=10); -INSERT INTO null_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3, 'Asia/Istanbul')), (3, toFloat32(1)), (4, toFloat64(2)); +INSERT INTO null_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3)), (3, toFloat32(1)), (4, toFloat64(2)); SELECT *, dynamicType(n2) FROM to_table ORDER BY ALL; DROP TABLE null_table; diff --git a/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.reference b/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.reference index 17f77dfe299..2d3b2f118f6 100644 --- a/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.reference +++ b/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.reference @@ -1,12 +1,12 @@ 1 2024-01-01 Date false -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') false +2 1704056400 Decimal(18, 3) false 3 1 Float32 true 4 2 Float64 true 1 2024-01-01 Date false 1 2024-01-01 Date false -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') false -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') false +2 1704056400 Decimal(18, 3) false +2 1704056400 Decimal(18, 3) false 3 1 Float32 false 3 1 Float32 false 4 2 Float64 false @@ -15,9 +15,9 @@ 1 2024-01-01 Date true 1 2024-01-01 Date true 1 2024-01-01 Date true -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') true -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') true -2 2024-01-01 00:00:00.000 DateTime64(3, \'Asia/Istanbul\') true +2 1704056400 Decimal(18, 3) true +2 1704056400 Decimal(18, 3) true +2 1704056400 Decimal(18, 3) true 3 1 Float32 true 3 1 Float32 true 3 1 Float32 true diff --git a/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql b/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql index e476d34a1db..b7d3fb7eb3d 100644 --- a/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql +++ b/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql @@ -10,17 +10,17 @@ CREATE TABLE to_table ) ENGINE = MergeTree ORDER BY n1; -INSERT INTO to_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3, 'Asia/Istanbul')), (3, toFloat32(1)), (4, toFloat64(2)); +INSERT INTO to_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3)), (3, toFloat32(1)), (4, toFloat64(2)); SELECT *, dynamicType(n2), isDynamicElementInSharedData(n2) FROM to_table ORDER BY ALL; select ''; ALTER TABLE to_table MODIFY COLUMN n2 Dynamic(max_types=5); -INSERT INTO to_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3, 'Asia/Istanbul')), (3, toFloat32(1)), (4, toFloat64(2)); +INSERT INTO to_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3)), (3, toFloat32(1)), (4, toFloat64(2)); SELECT *, dynamicType(n2), isDynamicElementInSharedData(n2) FROM to_table ORDER BY ALL; select ''; ALTER TABLE to_table MODIFY COLUMN n2 Dynamic(max_types=0); -INSERT INTO to_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3, 'Asia/Istanbul')), (3, toFloat32(1)), (4, toFloat64(2)); +INSERT INTO to_table ( n1, n2 ) VALUES (1, '2024-01-01'), (2, toDateTime64('2024-01-01', 3)), (3, toFloat32(1)), (4, toFloat64(2)); SELECT *, dynamicType(n2), isDynamicElementInSharedData(n2) FROM to_table ORDER BY ALL; ALTER TABLE to_table MODIFY COLUMN n2 Dynamic(max_types=500); -- { serverError UNEXPECTED_AST_STRUCTURE } From 3f945619b46ce35d80656bce45aedd907e23bc88 Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Thu, 21 Nov 2024 09:40:38 +0800 Subject: [PATCH 5/5] fix case --- tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql b/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql index 41418688943..5d3b455e257 100644 --- a/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql +++ b/tests/queries/0_stateless/03151_dynamic_type_scale_max_types.sql @@ -1,6 +1,7 @@ SET allow_experimental_dynamic_type = 1; SET allow_suspicious_types_in_order_by = 1; SET optimize_read_in_order = 1; +SET session_timezone = 'UTC'; drop table if exists to_table;