mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #69311 from Avogar/dynamic-primary-key
Mark Dynamic type as not safe primary key type to avoid issues with Fields
This commit is contained in:
commit
804012b2e4
@ -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;
|
||||
|
@ -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