Skip to content

Commit d6cf2af

Browse files
Backport ClickHouse#89819 to 25.8: Fix reading paths and paths subcolumns from advanced shared data serialization
1 parent 1605f3a commit d6cf2af

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/DataTypes/Serializations/SerializationObjectSharedData.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,9 @@ std::shared_ptr<SerializationObjectSharedData::PathsDataGranules> SerializationO
962962
throw Exception(ErrorCodes::LOGICAL_ERROR, "Info for path {} is not deserialized", requested_path);
963963

964964
const auto & path_info = path_info_it->second;
965+
/// Reset callbacks that might be different for different paths.
966+
deserialization_settings.seek_stream_to_current_mark_callback = {};
967+
deserialization_settings.getter = {};
965968

966969
/// If we have only subcolumns requested for this path, read all subcolumns.
967970
auto paths_subcolumns_it = structure_state.requested_paths_subcolumns.find(requested_path);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
['{"arr1":9}'] {}
2+
['{"arr1":9}'] {}
3+
[] {"b":[{"c":42}]}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
DROP TABLE IF EXISTS t0;
2+
CREATE TABLE t0 (c0 JSON(max_dynamic_paths = 0)) ENGINE = MergeTree ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 1, object_serialization_version = 'v3', object_shared_data_serialization_version_for_zero_level_parts = 'advanced', object_shared_data_buckets_for_wide_part = 1, index_granularity=2;
3+
4+
INSERT INTO t0 SELECT multiIf(
5+
number < 2,
6+
'{"arr" : [{"arr1" : 9}]}',
7+
'{"a" : {"b" : [{"c" : 42}]}}'
8+
) FROM numbers(3);
9+
10+
SELECT c0.arr.:`Array(JSON)`, c0.^a FROM t0;
11+
DROP TABLE t0;
12+

0 commit comments

Comments
 (0)