mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Mark Dynamic type as not safe primary key type to avoid issues with Fields
This commit is contained in:
parent
a7d0a5991e
commit
f22876302e
@ -50,6 +50,9 @@ bool isSafePrimaryDataKeyType(const IDataType & data_type)
|
||||
case TypeIndex::Float64:
|
||||
case TypeIndex::Nullable:
|
||||
case TypeIndex::ObjectDeprecated:
|
||||
case TypeIndex::Object:
|
||||
case TypeIndex::Variant:
|
||||
case TypeIndex::Dynamic:
|
||||
return false;
|
||||
case TypeIndex::Array:
|
||||
{
|
||||
@ -76,16 +79,6 @@ bool isSafePrimaryDataKeyType(const IDataType & data_type)
|
||||
const auto & data_type_map = static_cast<const DataTypeMap &>(data_type);
|
||||
return isSafePrimaryDataKeyType(*data_type_map.getKeyType()) && isSafePrimaryDataKeyType(*data_type_map.getValueType());
|
||||
}
|
||||
case TypeIndex::Variant:
|
||||
{
|
||||
const auto & data_type_variant = static_cast<const DataTypeVariant &>(data_type);
|
||||
const auto & data_type_variant_elements = data_type_variant.getVariants();
|
||||
for (const auto & data_type_variant_element : data_type_variant_elements)
|
||||
if (!isSafePrimaryDataKeyType(*data_type_variant_element))
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
|
37
tests/queries/0_stateless/00000_test.reference
Normal file
37
tests/queries/0_stateless/00000_test.reference
Normal file
@ -0,0 +1,37 @@
|
||||
a
|
||||
a
|
||||
a
|
||||
b
|
||||
xx
|
||||
xx
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
---
|
||||
4
|
||||
xx
|
||||
xx
|
||||
a 2020-01-01 00:00:00.000
|
||||
a 2020-01-01 10:10:10.000
|
||||
a 2020-01-01 10:10:10.110
|
||||
a 1
|
||||
a 1
|
||||
a 1
|
||||
a a
|
||||
a a
|
||||
a b
|
||||
a \N
|
||||
a \N
|
||||
a \N
|
||||
a \N
|
||||
a \N
|
||||
z a
|
12
tests/queries/0_stateless/00000_test.sql
Normal file
12
tests/queries/0_stateless/00000_test.sql
Normal file
@ -0,0 +1,12 @@
|
||||
set max_threads = 1, read_in_order_two_level_merge_threshold = 1;
|
||||
|
||||
CREATE OR REPLACE TABLE test(
|
||||
key String,
|
||||
val Map(String, String)
|
||||
) engine = MergeTree
|
||||
order by key settings min_bytes_for_wide_part = 0;
|
||||
insert into test VALUES ('', {'x':'xx'});
|
||||
insert into test VALUES ('', {});
|
||||
SELECT key, arrayJoin(mapValues(val)) as v FROM test ORDER BY key, v;
|
||||
DROP TABLE test;
|
||||
|
@ -0,0 +1,10 @@
|
||||
SET allow_experimental_dynamic_type = 1;
|
||||
DROP TABLE IF EXISTS t0;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t0 (c0 Int) ENGINE = AggregatingMergeTree() ORDER BY (c0);
|
||||
CREATE TABLE t1 (c0 Array(Dynamic), c1 Int) ENGINE = MergeTree() ORDER BY (c0);
|
||||
INSERT INTO t1 (c0, c1) VALUES ([18446717433683171873], 13623876564923702671), ([-4], 6111684076076982207);
|
||||
SELECT 1 FROM t0 FINAL JOIN t1 ON TRUE;
|
||||
DROP TABLE t0;
|
||||
DROP TABLE t1;
|
||||
|
Loading…
Reference in New Issue
Block a user