mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Merge pull request #71747 from ClickHouse/backport/24.8/71369
Backport #71369 to 24.8: Check suspicious and experimental types in JSON type hints
This commit is contained in:
commit
aa7b7097f3
@ -222,6 +222,15 @@ MutableColumnPtr DataTypeObject::createColumn() const
|
|||||||
return ColumnObject::create(std::move(typed_path_columns), max_dynamic_paths, max_dynamic_types);
|
return ColumnObject::create(std::move(typed_path_columns), max_dynamic_paths, max_dynamic_types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataTypeObject::forEachChild(const ChildCallback & callback) const
|
||||||
|
{
|
||||||
|
for (const auto & [path, type] : typed_paths)
|
||||||
|
{
|
||||||
|
callback(*type);
|
||||||
|
type->forEachChild(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ public:
|
|||||||
|
|
||||||
bool equals(const IDataType & rhs) const override;
|
bool equals(const IDataType & rhs) const override;
|
||||||
|
|
||||||
|
void forEachChild(const ChildCallback &) const override;
|
||||||
|
|
||||||
bool hasDynamicSubcolumnsData() const override { return true; }
|
bool hasDynamicSubcolumnsData() const override { return true; }
|
||||||
std::unique_ptr<SubstreamData> getDynamicSubcolumnData(std::string_view subcolumn_name, const SubstreamData & data, bool throw_if_null) const override;
|
std::unique_ptr<SubstreamData> getDynamicSubcolumnData(std::string_view subcolumn_name, const SubstreamData & data, bool throw_if_null) const override;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
-- Tags: no-fasttest
|
-- Tags: no-fasttest
|
||||||
|
|
||||||
set allow_experimental_json_type = 1;
|
set allow_experimental_json_type = 1;
|
||||||
|
set allow_experimental_dynamic_type = 1;
|
||||||
drop table if exists test;
|
drop table if exists test;
|
||||||
create table test (json JSON(a Dynamic)) engine=MergeTree order by tuple() settings min_rows_for_wide_part=1, min_bytes_for_wide_part=1;
|
create table test (json JSON(a Dynamic)) engine=MergeTree order by tuple() settings min_rows_for_wide_part=1, min_bytes_for_wide_part=1;
|
||||||
insert into test select '{"a" : 42}';
|
insert into test select '{"a" : 42}';
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
set allow_experimental_json_type=1;
|
||||||
|
set allow_experimental_variant_type=0;
|
||||||
|
set allow_experimental_object_type=0;
|
||||||
|
|
||||||
|
select '{}'::JSON(a LowCardinality(Int128)); -- {serverError SUSPICIOUS_TYPE_FOR_LOW_CARDINALITY}
|
||||||
|
select '{}'::JSON(a FixedString(100000)); -- {serverError ILLEGAL_COLUMN}
|
||||||
|
select '{}'::JSON(a Variant(Int32)); -- {serverError ILLEGAL_COLUMN}
|
||||||
|
select '{}'::JSON(a Object('json')); -- {serverError ILLEGAL_COLUMN}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user