Extract conversion functions in FunctionsConversion.h#97704
Merged
Algunenano merged 6 commits intoClickHouse:masterfrom Feb 24, 2026
Merged
Extract conversion functions in FunctionsConversion.h#97704Algunenano merged 6 commits intoClickHouse:masterfrom
Algunenano merged 6 commits intoClickHouse:masterfrom
Conversation
Contributor
Move 41 non-trivial `FunctionCast` method bodies from `FunctionsConversion.h` into `FunctionsConversion.cpp`. Each of the 32 `FunctionsConversion_impl*.cpp` files was spending ~13s compiling `FunctionCast` methods defined inline in the header — this was 100% redundant since `FunctionCast` is a non-template class. Time-trace of impl07 confirms: compile time dropped from ~30s to 4.7s, with `FunctionCast` parsing reduced from ~13s to 0.01s. Across all 32 TUs this eliminates ~400s of total CPU time. Methods kept inline: constructor, trivial getters, and small static helpers (`createFunctionAdaptor`, `createToNullableColumnWrapper`, `createIdentityWrapper`, `createNothingWrapper`). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # src/Functions/FunctionsConversion.h
`TYPE_MISMATCH`, `CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN`, and `SIZES_OF_ARRAYS_DONT_MATCH` were moved to the cpp file but their declarations were left behind in the header. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sion.h Fix clang-tidy `readability-avoid-const-params-in-decls` errors for `createWrapper`, `createBoolWrapper`, `createUInt8ToBoolWrapper`, and `createFixedStringWrapper` declarations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ecute On master, `ConvertImpl::execute` is marked `NO_SANITIZE_UNDEFINED`. When helper functions were extracted from it, the attribute was lost, causing UBSan to flag the previously-suppressed `static_cast` overflow in `convertNumericGeneral`. Restore the attribute on all extracted helpers: `convertToBool`, `convertFromUUIDToUInt128`, `convertFromUInt128toIPv6`, `convertFromIPv6ToUInt128`, `convertDateTimeToZero`, `convertFromIPv6ToIPv4`, `convertFromIPv4ToIPv6`, `convertFromUInt64ToIPv4`, `convertToUnixTimestampFromDate`, `convertDecimal`, and `convertNumericGeneral`. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97704&sha=662251436bb541092bf3701340a2f4a65bb4d972&name_0=PR&name_1=Stateless%20tests%20%28amd_ubsan%2C%20parallel%29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Algunenano
added a commit
to Algunenano/ClickHouse
that referenced
this pull request
Feb 24, 2026
Add rules to catch compilation time regressions during code review: non-trivial code in widely-included headers, heavy transitive includes in high-fan-out headers, unnecessary template instantiations, and large `constexpr` evaluation in headers. Inspired by ClickHouse#97704, ClickHouse#97497, ClickHouse#97496. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Extract conversion functions in FunctionsConversion.h
This should be purely a refactor into smaller functions in order to not have a huge, not optimizable, loop
constexprfunctions. It will allow introducing further optimizations (some dynamic dispatch at least) and in any case the code should be clearer.Documentation entry for user-facing changes