mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Fix structure comparison between 2 JSON columns
This commit is contained in:
parent
696114ff1a
commit
ca880ccdee
@ -127,7 +127,7 @@ std::string ColumnObject::getName() const
|
|||||||
{
|
{
|
||||||
WriteBufferFromOwnString ss;
|
WriteBufferFromOwnString ss;
|
||||||
ss << "Object(";
|
ss << "Object(";
|
||||||
ss << "max_dynamic_paths=" << max_dynamic_paths;
|
ss << "max_dynamic_paths=" << global_max_dynamic_paths;
|
||||||
ss << ", max_dynamic_types=" << max_dynamic_types;
|
ss << ", max_dynamic_types=" << max_dynamic_types;
|
||||||
std::vector<String> sorted_typed_paths;
|
std::vector<String> sorted_typed_paths;
|
||||||
sorted_typed_paths.reserve(typed_paths.size());
|
sorted_typed_paths.reserve(typed_paths.size());
|
||||||
@ -1047,7 +1047,7 @@ bool ColumnObject::structureEquals(const IColumn & rhs) const
|
|||||||
{
|
{
|
||||||
/// 2 Object columns have equal structure if they have the same typed paths and max_dynamic_paths/max_dynamic_types.
|
/// 2 Object columns have equal structure if they have the same typed paths and max_dynamic_paths/max_dynamic_types.
|
||||||
const auto * rhs_object = typeid_cast<const ColumnObject *>(&rhs);
|
const auto * rhs_object = typeid_cast<const ColumnObject *>(&rhs);
|
||||||
if (!rhs_object || typed_paths.size() != rhs_object->typed_paths.size() || max_dynamic_paths != rhs_object->max_dynamic_paths || max_dynamic_types != rhs_object->max_dynamic_types)
|
if (!rhs_object || typed_paths.size() != rhs_object->typed_paths.size() || global_max_dynamic_paths != rhs_object->global_max_dynamic_paths || max_dynamic_types != rhs_object->max_dynamic_types)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (const auto & [path, column] : typed_paths)
|
for (const auto & [path, column] : typed_paths)
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
{"foo1":"bar"} {"foo1":"bar"}
|
||||||
|
{"foo2":"bar"} {"foo2":"bar"}
|
||||||
|
{"foo2":"bar"} {"foo2":"bar"}
|
@ -0,0 +1,22 @@
|
|||||||
|
SET allow_experimental_json_type=1;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS test_new_json_type;
|
||||||
|
|
||||||
|
CREATE TABLE test_new_json_type(id UInt32, data JSON, version UInt64) ENGINE=ReplacingMergeTree(version) ORDER BY id;
|
||||||
|
|
||||||
|
INSERT INTO test_new_json_type format JSONEachRow
|
||||||
|
{"id":1,"data":{"foo1":"bar"},"version":1}
|
||||||
|
{"id":2,"data":{"foo2":"bar"},"version":1}
|
||||||
|
{"id":3,"data":{"foo2":"bar"},"version":1}
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
a.data
|
||||||
|
, b.data
|
||||||
|
FROM
|
||||||
|
test_new_json_type a
|
||||||
|
JOIN test_new_json_type b
|
||||||
|
ON a.id = b.id;
|
||||||
|
|
||||||
|
DROP TABLE test_new_json_type;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user