Skip to content

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

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

robot-clickhouse merged 8 commits into
backport/26.7/112604from
cherrypick/26.7/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 three conflicts.

`contrib/orc`: take the bump's pointer, ORC 2.3.1.

`contrib/arrow-cmake/CMakeLists.txt`: the release branch does not have the
`ENABLE_ORC` option, so the `orc_proto.proto` custom command is not wrapped in a
condition there. Keep the release branch's unwrapped form and add the `DEPENDS`
argument, which is the part being backported.

`src/Processors/Formats/Impl/NativeORCBlockInputFormat.cpp`: drop the hunk. It
adds `GEOMETRY`/`GEOGRAPHY` cases to `orcUnionBranchMatchesType`, a function the
release branch does not have -- the ORC union-branch matching is not on this
branch. The new ORC 2.3 enumerators are otherwise harmless here: every remaining
switch over `orc::TypeKind` on this branch has a `default:` label, so none of them
becomes non-exhaustive.
@robot-clickhouse
robot-clickhouse merged commit 1c03eed into backport/26.7/112604 Aug 5, 2026
1 check passed
@robot-clickhouse
robot-clickhouse deleted the cherrypick/26.7/112604 branch August 5, 2026 17:23
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