Skip to content

Patch Arrow to set CMAKE_POLICY_VERSION_MINIMUM for RapidJSON - #22582

Merged
rapids-bot[bot] merged 3 commits into
NVIDIA:release/26.06from
KyleFromNVIDIA:patch-arrow-rapidjson-cmake-policy-version-minimum
May 19, 2026
Merged

Patch Arrow to set CMAKE_POLICY_VERSION_MINIMUM for RapidJSON#22582
rapids-bot[bot] merged 3 commits into
NVIDIA:release/26.06from
KyleFromNVIDIA:patch-arrow-rapidjson-cmake-policy-version-minimum

Conversation

@KyleFromNVIDIA

@KyleFromNVIDIA KyleFromNVIDIA commented May 19, 2026

Copy link
Copy Markdown
Member

Description

Provide a patch for apache/arrow#48801

Fixes #22540

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@KyleFromNVIDIA
KyleFromNVIDIA requested review from a team as code owners May 19, 2026 18:19
@KyleFromNVIDIA KyleFromNVIDIA added bug Something isn't working non-breaking Non-breaking change labels May 19, 2026
@github-actions github-actions Bot added libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue Java Affects Java cuDF API. labels May 19, 2026
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2ae42f20-5f38-4ee8-b1e4-bf5a423da526

📥 Commits

Reviewing files that changed from the base of the PR and between 2021624 and 351bcdf.

📒 Files selected for processing (1)
  • cpp/cmake/thirdparty/patches/override.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/cmake/thirdparty/patches/override.json

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Apply an override to pin the Arrow dependency and include a compatibility patch to limit RapidJSON’s CMake policy impact during discovery.
    • Update build initialization to automatically load the dependency override file, improving consistency and reproducibility of builds.

Walkthrough

This PR scopes a temporary CMake policy change to CMAKE_POLICY_VERSION_MINIMUM=3.5 around RapidJSON discovery, registers that patch in an Arrow override JSON, and passes the override to rapids_cpm_init during native build initialization.

Changes

CMake RapidJSON Policy Configuration

Layer / File(s) Summary
RapidJSON CMake policy patch
cpp/cmake/thirdparty/patches/arrow_rapidjson_cmake_policy_version_minimum.diff
CMake patch saves and restores CMAKE_POLICY_VERSION_MINIMUM around the find_package(RapidJSON ...) call, limiting policy-minimum scope to that invocation.
Arrow dependency override configuration
cpp/cmake/thirdparty/patches/override.json
JSON configuration defines Arrow 21.0.0 from Apache Arrow repository with full clone and applies the RapidJSON CMake policy patch.
Build system integration
java/src/main/native/CMakeLists.txt
Rapids CPM initialization switches from bare rapids_cpm_init() to parameterized call with OVERRIDE pointing to the patch override configuration file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: patching Arrow to set CMAKE_POLICY_VERSION_MINIMUM for RapidJSON, which aligns with the changeset's primary objective.
Description check ✅ Passed The description references issue #22540 which documents the Arrow/RapidJSON CMake compatibility problem that this PR addresses through the provided patch.
Linked Issues check ✅ Passed The PR successfully implements the required workaround: it creates a patch file for Arrow that sets CMAKE_POLICY_VERSION_MINIMUM to 3.5 during RapidJSON's find_package call, directly addressing the CMake 4.0.7 compatibility issue [#22540].
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to implementing the required Arrow patch and applying it via the override.json configuration and CMakeLists.txt update, with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
cpp/cmake/thirdparty/patches/override.json (1)

8-8: ⚡ Quick win

Consider using shallow clone if patch target is available at the specified tag.

Setting git_shallow: false forces a full clone of the Arrow repository, which can significantly increase initial build times (Arrow repo is large). Since the patch targets cpp/cmake_modules/FindRapidJSONAlt.cmake — a core CMake infrastructure file that exists in the apache-arrow-21.0.0 tag — a shallow clone would be sufficient for applying this patch. Shallow clones are preferred unless the patch requires commit history or targets files not present in the specified tag.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/cmake/thirdparty/patches/override.json` at line 8, The override JSON
currently sets "git_shallow": false causing full clones of the Arrow repo;
change it to "git_shallow": true in cpp/cmake/thirdparty/patches/override.json
(the JSON key "git_shallow") so the fetch uses a shallow clone for the
apache-arrow-21.0.0 tag (since the patched file
cpp/cmake_modules/FindRapidJSONAlt.cmake exists in that tag) unless the patch
requires history—ensure no other build step needs full history before flipping
the flag.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@cpp/cmake/thirdparty/patches/arrow_rapidjson_cmake_policy_version_minimum.diff`:
- Around line 9-12: The current patch unconditionally saves and restores
CMAKE_POLICY_VERSION_MINIMUM which causes an empty string to be written if the
variable was originally unset; update the logic around the save/restore of
CMAKE_POLICY_VERSION_MINIMUM (the temporary variable
_CMAKE_POLICY_VERSION_MINIMUM_OLD and the restore after find_package(RapidJSON
...)) to first test whether CMAKE_POLICY_VERSION_MINIMUM was defined (using
CMake's DEFINED check), only set _CMAKE_POLICY_VERSION_MINIMUM_OLD when it
exists, set CMAKE_POLICY_VERSION_MINIMUM to 3.5 for the RapidJSON find, and then
restore the previous state by either resetting CMAKE_POLICY_VERSION_MINIMUM to
the saved value or unsetting it when it was originally undefined.

---

Nitpick comments:
In `@cpp/cmake/thirdparty/patches/override.json`:
- Line 8: The override JSON currently sets "git_shallow": false causing full
clones of the Arrow repo; change it to "git_shallow": true in
cpp/cmake/thirdparty/patches/override.json (the JSON key "git_shallow") so the
fetch uses a shallow clone for the apache-arrow-21.0.0 tag (since the patched
file cpp/cmake_modules/FindRapidJSONAlt.cmake exists in that tag) unless the
patch requires history—ensure no other build step needs full history before
flipping the flag.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5ae8235f-e502-41a2-b859-ca0a53609a07

📥 Commits

Reviewing files that changed from the base of the PR and between 2dba3ec and 85fc85d.

📒 Files selected for processing (3)
  • cpp/cmake/thirdparty/patches/arrow_rapidjson_cmake_policy_version_minimum.diff
  • cpp/cmake/thirdparty/patches/override.json
  • java/src/main/native/CMakeLists.txt

Comment thread cpp/cmake/thirdparty/patches/override.json Outdated
@pmattione-nvidia

Copy link
Copy Markdown
Contributor

This is just for the release branch. Does it need to go into the main branch as well?

@KyleFromNVIDIA

Copy link
Copy Markdown
Member Author

It will be automatically forward-merged into the main branch, no problem.

@KyleFromNVIDIA

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 5e6631f into NVIDIA:release/26.06 May 19, 2026
114 of 115 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 19, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CMake CMake build issue Java Affects Java cuDF API. libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants