mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2026-10-28 16:18:23 +08:00
Reading a full `JSON` column caches the accumulated output block. Slice that cached parent to the current granule before extracting shared paths, so subsequent subcolumn reads do not repeatedly scan earlier rows. Add functional coverage for shared paths across granules and block boundaries, plus a focused performance test. With compatible existing build dependencies, seven local runs improve the full-parent/shared-path median from 4.4583 s to 0.28334 s. The subcolumns-only control has no statistically significant change. Both functional regressions pass. https://github.com/ClickHouse/ClickHouse/pull/110957#discussion_r3999490724
24 lines
945 B
XML
24 lines
945 B
XML
<test>
|
|
<settings>
|
|
<max_threads>1</max_threads>
|
|
<max_block_size>8192</max_block_size>
|
|
</settings>
|
|
|
|
<create_query>
|
|
CREATE TABLE json_compact_shared_path_cache (id UInt64, j JSON(max_dynamic_paths = 0))
|
|
ENGINE = MergeTree ORDER BY id
|
|
SETTINGS index_granularity = 1,
|
|
min_bytes_for_wide_part = '1G', write_marks_for_substreams_in_compact_parts = 0
|
|
</create_query>
|
|
<fill_query>
|
|
INSERT INTO json_compact_shared_path_cache
|
|
SELECT number, toJSONString(map('a', number, 'b', number + 1)) FROM numbers(8192)
|
|
</fill_query>
|
|
|
|
<!-- Reading both the parent and shared paths must not scan earlier granules again. -->
|
|
<query>SELECT j, j.a, j.b FROM json_compact_shared_path_cache FORMAT Null</query>
|
|
<query>SELECT j.a, j.b FROM json_compact_shared_path_cache FORMAT Null</query>
|
|
|
|
<drop_query>DROP TABLE json_compact_shared_path_cache</drop_query>
|
|
</test>
|