This commit is contained in:
李扬 2024-11-21 14:14:32 +08:00 committed by GitHub
commit f58759b1a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 7 deletions

View File

@ -2187,7 +2187,7 @@ public:
if constexpr (std::is_same_v<ToDataType, DataTypeString>)
return {};
else if constexpr (std::is_same_v<ToDataType, DataTypeDateTime64>)
return {2};
return {1, 2};
return {1};
}
bool canBeExecutedOnDefaultArguments() const override { return false; }

View File

@ -1,4 +1,5 @@
SET allow_experimental_dynamic_type=1;
SET session_timezone = 'UTC';
SET allow_suspicious_types_in_order_by=1;
DROP TABLE IF EXISTS null_table;
@ -21,11 +22,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 '';
@ -34,7 +35,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;

View File

@ -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;
@ -11,17 +12,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 }