Skip to content

Re-implement #117803 - #120690

Open
rschu1ze wants to merge 9 commits into
masterfrom
re-implement-117803
Open

rschu1ze wants to merge 9 commits into
masterfrom
re-implement-117803

Conversation

@rschu1ze

@rschu1ze rschu1ze commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Closes: #117186
Related: #117803

Re-implements #117803 (= reverts it + implements it properly).

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Workflow [PR]
Sync PR [sync-upstream/pr/120690]

@clickhouse-gh

clickhouse-gh Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [50bf040]

Summary: ❌

job_name test_name status info comment
Fast test FAIL
05218_autopr_populates_query_condition_cache FAIL cidb
Code Review DROPPED
Fast test (arm_darwin) DROPPED
Build (amd_debug) DROPPED
Build (amd_asan_ubsan) DROPPED
Build (amd_tsan) DROPPED
Build (amd_msan) DROPPED
Build (amd_binary) DROPPED
Build (arm_debug) DROPPED
Build (arm_asan_ubsan) DROPPED

return setting_name == "log_comment"
/// As of today, the output format settings only affect the final output.
/// However, it should be taken with caution - we should not use these settings in deterministic SQL functions.
|| setting_name.starts_with("output_format_")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output_format_* cannot be treated as QCC-irrelevant here. FunctionConvertSettings still snapshots getFormatSettings(context) (src/Functions/FunctionsConversion.h:153), and getFormatSettings fills output_format_decimal_trailing_zeros, output_format_trim_fixed_string, output_format_values_escape_quote_with_quote, etc. (src/Formats/FormatFactory.cpp:239-242,355). That means predicates such as toString(decimal_col) = '1.0' can change truth value when only an output_format_* setting flips. With this prefix ignore, a "no marks match" entry written under one formatting mode becomes reusable under the other, which brings back the wrong-result class this PR is trying to fix.

/// Note: `changes()` returns the settings in random order but we must update the composite hash in deterministic order.
/// Therefore, first collect and sort the settings changes, then hash them.
std::vector<std::pair<std::string_view, String>> changed_settings_sorted; /// (name, value)
const SettingsChanges changed_settings = settings.changes();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hashing the entire Settings::changes() set here makes QCC hits depend on unrelated execution knobs and internal planning settings, not just on filter semantics. The test updates in this PR are already showing that regression: 02346_text_index_bug108519_qcc_skip_index.sql now has to pin max_block_size, max_threads, use_skip_indexes_on_data_read, and parallel_replicas_for_cluster_engines just to let an EXPLAIN reuse the same row-level entry, and 04669_query_condition_cache_lightweight_delete.sql had to stop reusing across apply_mutations_on_fly. That is a large hit-rate drop for a hot cache even when the predicate and data snapshot are unchanged. Please normalize/ignore the non-semantic settings instead of keying on the raw SettingsChanges set.

@clickhouse-gh

clickhouse-gh Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 491c532c8 with master 66cba7b9a (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

109 object files changed (-58.11 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Interpreters/Cache/QueryConditionCache.cpp.o 295.73 KiB 230.43 KiB -65.30 KiB (-22.08%)

716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

414 translation units recompiled, 3804 s compile time in total, 414 of them have a recent master baseline.

Job report

@alexey-milovidov alexey-milovidov added the close in a month if not active This will be closed in case of no information label Nov 17, 2026
@clickhouse-gh clickhouse-gh Bot added comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. and removed comp-filesystem-cache Filesystem cache for remote/object storage, page cache, and read caching infrastructure. labels Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

close in a month if not active This will be closed in case of no information comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query condition cache serves another session's verdict when an omitted DateTime timezone hides inside a wrapper type: rows silently vanish

3 participants