Skip to content

Cherry pick #112604 to 26.3: Bump arrow to 25.0.0, orc to 2.3.1 and xsimd to 14.2.0 - #113172

Merged
robot-clickhouse merged 8 commits into
backport/26.3/112604from
cherrypick/26.3/112604
Aug 5, 2026
Merged

robot-clickhouse merged 8 commits into
backport/26.3/112604from
cherrypick/26.3/112604

Conversation

@robot-clickhouse

Copy link
Copy Markdown
Member

Original pull-request #112604

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

thevar1able and others added 7 commits July 30, 2026 15:38
`xsimd` is tracked directly against upstream and carries no ClickHouse patches,
so this is a plain pointer move.

Required by `arrow` 25, which pins 14.2.0: `arrow/util/cpu_info.cc` uses
`xsimd::cpu_features`, `xsimd::x86_cpu_features_backend_default`,
`xsimd::x86_cpuid_leaf7` and `xsimd::x86_manufacturer`, none of which exist in
14.0.0.
The pinned fork was 2.1.2 plus 8 ClickHouse commits. Rebased onto
`rel/release-2.3.1`; the resulting fork history is 5 commits plus a vendored
schema update.

`Reject out-of-range union tags instead of reading out of bounds` was dropped:
upstream added `getCheckedUnionTag` and applies it at all three call sites
(`UnionColumnReader::skip` and both branches of `UnionColumnReader::next`), so
it is at least as complete as the local patch and checks at the point of use
rather than in a pre-pass. The other hardening patches are still absent
upstream and were kept: bounding type-tree nesting depth when reading the
footer, rejecting an out-of-range column id in
`StripeInformationImpl::getColumnEncoding`, and the `ColumnReader`
heap-use-after-free fix.

ORC does not ship its format definition in-tree; it reads `orc_proto.proto`
from an `orc-format` `ExternalProject` download, and we vendor the file in the
fork instead. The vendored copy still matched 2.1.2, so it had to be updated to
`orc-format` 1.1.1, which 2.3.1 pins - 2.3 added the geospatial types and the
C++ sources reference `proto::GeospatialStatistics`, `Type::crs`,
`Type::algorithm` and `Type_Kind_GEOMETRY`/`GEOGRAPHY`.

`add_custom_command` for `orc_proto.pb.h` had no `DEPENDS`, so the generated
sources were never regenerated when the schema or `protoc` changed and a stale
header was compiled instead. Adding the dependency is what makes the schema
update above take effect.

`Dictionary.cc`, `DictionaryLoader.cc` and `Geospatial.cc` are new upstream
sources that have to be compiled (`SortedStringDictionary`,
`loadStringDictionary`, `geospatial::WKBGeometryBounder`). `BpackingAvx512.cc`
is deliberately not added: upstream only builds it under
`BUILD_ENABLE_AVX512`, which we do not set.

2.3 also adds `GEOMETRY` and `GEOGRAPHY` to `orc::TypeKind`, so the exhaustive
switch in `orcUnionBranchMatchesType` has to handle them. We do not read those
types, so no target type can match such a union branch.
The pinned fork was 23.0.1 plus 11 ClickHouse commits. Rebased onto
`apache-arrow-25.0.0`; two patches were dropped as obsolete:

- `Fix deadlock with msan` and `Fix undefined symbol: pthread_atfork on
  PowerPC64` both target `AfterForkState`/`GlobalForkSafeMutex` in
  `util/mutex.cc`, which upstream removed outright - fork handling now lives in
  `util/atfork_internal.cc`.

`Dont abort in ~CerrLog` was kept but re-applied on top of upstream`s
refactoring, which now buffers into an `std::ostringstream buffer_` and prints
under a mutex. We keep the local behaviour (buffer, no `std::cerr` output,
throw instead of `PrintBackTrace` + `std::abort`) while adopting upstream`s
member name so the next rebase is smaller.

Upstream renamed the bit-packing SIMD sources: `bpacking_simd_default.cc` ->
`bpacking_simd_128.cc` and `bpacking_simd_avx2.cc` -> `bpacking_simd_256.cc`.
`util/ulp_distance.cc` (`internal::WithinUlp`) is new and has to be compiled.

Parquet Variant support moved out of `parquet/arrow/variant_internal.cc` into
the Arrow extension type `arrow/extension/parquet_variant.cc`, which upstream
builds unconditionally alongside the other extension types we already list.

`parquet/bloom_filter_avx2.cc` has to be built when AVX2 is available because
the Bloom filter dispatch table references `FindHashBlockAvx2`. Unlike
`level_comparison_avx2.cc`, which we list unconditionally, it instantiates
`xsimd::batch<uint32_t, xsimd::avx2>` and so is x86-only.

`arrow::decimal` was removed. It is deliberately not replaced with
`arrow::smallest_decimal`: Arrow gained `Decimal32` and `Decimal64`, so that
function would narrow small decimals and change the schema we write. The
explicit `Decimal256` above precision 38, `Decimal128` otherwise rule
reproduces what `arrow::decimal` did.

Requires `xsimd` 14.2.0, which Arrow 25 pins - `util/cpu_info.cc` uses
`xsimd::cpu_features`, `x86_cpu_features_backend_default`, `x86_cpuid_leaf7`
and `x86_manufacturer`, none of which exist in 14.0.0.
Bump `arrow` to 25.0.0, `orc` to 2.3.1 and `xsimd` to 14.2.0
@robot-clickhouse robot-clickhouse added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request labels Aug 3, 2026
Resolve the conflicts, and add the `xsimd` submodule, which this release branch
does not have.

Arrow 25 requires `xsimd` unconditionally, unlike Arrow 23: `util/cpu_info.cc`
calls `xsimd::cpu_features` at the top level, and `util/bpacking_simd_128.cc`
(renamed from `bpacking_simd_default.cc`) includes
`bpacking_simd_kernel_internal.h`, which includes `<xsimd/xsimd.hpp>` with no
guard. Both are in the unconditional `ARROW_SRCS` list, so the dependency cannot
be avoided by leaving the SIMD codepaths off. Added `contrib/xsimd` at
`f795779ccfa`, `contrib/xsimd-cmake` (taken from master), the `add_contrib` line,
and the `.gitmodules` entry pointing at the ClickHouse fork -- upstream
`xtensor-stack/xsimd` does not have that commit.

`contrib/arrow` and `contrib/orc`: take the bump's pointers, Arrow 25.0.0 and
ORC 2.3.1.

`contrib/arrow-cmake/CMakeLists.txt`: the release branch has neither the
`ENABLE_ORC` option nor the Arrow SIMD block, and neither is being backported --
enabling Arrow's SIMD codepaths is a performance change, not part of this bump.
Keep the `orc_proto.proto` custom command unwrapped and add only its `DEPENDS`
argument; drop the SIMD block. The `bloom_filter_avx2.cc` addition is dropped for
the same reason: without `ARROW_HAVE_AVX2`/`ARROW_HAVE_RUNTIME_AVX2` the Bloom
filter dispatch table does not reference `FindHashBlockAvx2`
(`ARROW_DISPATCH_TARGET_AVX2` expands to nothing), so the kernel is not needed.

`src/Processors/Formats/Impl/NativeORCBlockInputFormat.cpp`: drop the hunk. It
adds `GEOMETRY`/`GEOGRAPHY` cases to `orcUnionBranchMatchesType`, a function the
release branch does not have. Every remaining switch over `orc::TypeKind` on this
branch has a `default:` label, so the new ORC 2.3 enumerators break nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants