Skip to content

Carry the ClickHouse patches from v4.6.11 onto v5.0.8 - #11

Merged
thevar1able merged 2 commits into
ClickHouse:ClickHouse/v5.0.8from
actueleai:ClickHouse/v5.0.8
Oct 30, 2026
Merged

thevar1able merged 2 commits into
ClickHouse:ClickHouse/v5.0.8from
actueleai:ClickHouse/v5.0.8

Conversation

@actueleai

Copy link
Copy Markdown

Rebases the ClickHouse patches onto upstream v5.0.8, original authors preserved.

  • Carried: fallback: honour SIMDJSON_UTF8VALIDATION in the scalar string scanner.
  • New: Restrict the SSE2 key-selector path to real x86. ondemand/key_selector.h (new in v5) takes its SSE2 path whenever __SSE2__ is defined, which breaks ClickHouse's ppc64le build (-D__SSE2__=1 emulation).
  • Dropped: Store 20-digit positive integers overflowing uint64 as big integers, upstream since Treat 20-digit positive overflows as big integers simdjson/simdjson#2793.

groeneai and others added 2 commits October 29, 2026 16:24
The SIMD backends already gate the stage-1 UTF-8 accumulate step on
SIMDJSON_UTF8VALIDATION (src/generic/stage1/json_structural_indexer.h),
which cmake/developer-options.cmake exposes as the SIMDJSON_SKIPUTF8VALIDATION
option. src/fallback.cpp never consults the macro: its scalar string scanner
calls validate_utf8_character() unconditionally, so a build configured with the
option ON still returns UTF8_ERROR whenever fallback is the active backend.

Put the same #if around that call. The #else arm advances a single byte, which
leaves the scan equivalent to the SIMD backends: every byte that matters
structurally (a quote, a backslash, a control character) is below 0x80, so
char_is_ascii_stop still stops on it at the next iteration whatever the
non-ASCII bytes happen to be, and the UNESCAPED_CHARS check is untouched.

implementation::validate_utf8() and the per-backend generic_validate_utf8() are
deliberately left alone: reporting encoding validity is their whole contract.

Co-Authored-By: Claude Opus 5 <[email protected]>
(cherry picked from commit e31ec45)
Non-x86 toolchains may predefine __SSE2__ to switch on their x86-intrinsic
emulation: ClickHouse builds ppc64le with -maltivec -D__SSE2__=1. clang's
ppc_wrappers then spell __m128i as __vector unsigned char while
_mm_loadu_si128 takes __m128i_u, so every load in key_selector.h fails with
"no known conversion from 'const __m128i *' to 'const __m128i_u *'" and the
ppc64le build breaks (ClickHouse PR #124651, Build (ppc64le)).

Require an actual x86 target before enabling SIMDJSON_KEY_SELECTOR_HAS_SSE2,
so such targets use the scalar key selector, which is correct and only
somewhat slower.
@thevar1able
thevar1able merged commit be21d52 into ClickHouse:ClickHouse/v5.0.8 Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants