fix race in data type Object

This commit is contained in:
Anton Popov 2022-03-18 14:52:07 +00:00
parent 9e88f3b4b9
commit 79bb493383
4 changed files with 12 additions and 3 deletions

View File

@ -19,7 +19,6 @@ namespace ErrorCodes
DataTypeObject::DataTypeObject(const String & schema_format_, bool is_nullable_)
: schema_format(Poco::toLower(schema_format_))
, is_nullable(is_nullable_)
, default_serialization(getObjectSerialization(schema_format))
{
}
@ -32,7 +31,7 @@ bool DataTypeObject::equals(const IDataType & rhs) const
SerializationPtr DataTypeObject::doGetDefaultSerialization() const
{
return default_serialization;
return getObjectSerialization(schema_format);
}
String DataTypeObject::doGetName() const

View File

@ -18,7 +18,6 @@ class DataTypeObject : public IDataType
private:
String schema_format;
bool is_nullable;
SerializationPtr default_serialization;
public:
DataTypeObject(const String & schema_format_, bool is_nullable_);

View File

@ -0,0 +1 @@
Tuple(k1 Int8, k2 String) 3000000

View File

@ -0,0 +1,10 @@
-- Tags: long
DROP TABLE IF EXISTS t_json_parallel;
SET allow_experimental_object_type = 1, max_insert_threads = 20, max_threads = 20;
CREATE TABLE t_json_parallel (data JSON) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO t_json_parallel SELECT materialize('{"k1":1, "k2": "some"}') FROM numbers_mt(3000000);
SELECT any(toTypeName(data)), count() FROM t_json_parallel;
DROP TABLE t_json_parallel;