GH-47167: [C++][Dev] Update clang-format dependency - #47168

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt
Jan 14, 2026
Merged

GH-47167: [C++][Dev] Update clang-format dependency#47168
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Update clang-format to better match modern IDEs.

What changes are included in this PR?

  • Update clang-format
  • Reformat code base with newer version

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #47167has been automatically assigned in GitHub to PR creator.

@raulcd

Copy link
Copy Markdown
Member

The Python failures are unrelated, I just merged the fix on main, if you rebase they will go away.
It seems the newer clang-format pre-commit (from 16.0.0) fails on Ubuntu 22.04 because textproto was added to identify 2.5.20 but Ubuntu seems to be using indentify 2.4.10-1 (https://packages.ubuntu.com/jammy/python3-identify).
@kou is using the system pre-commit a requirement? I am unsure what the discussion was when we moved from archery lint to pre-commit. Some info on when this was added:

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Without it, that sends back pre-commit to 15.*

@kou

kou commented Jul 23, 2025

Copy link
Copy Markdown
Member

Supporting old pre-commit (system pre-commit) is for new contributors on Ubuntu 22.04.

If we have enough documentation (or something) for new contributors, we can require more newer pre-commit (and identify).

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

pre-commit is very easy to install via either conda or pip. Are there other dependencies we are getting from these sources?

@kou

kou commented Jul 24, 2025

Copy link
Copy Markdown
Member

apache/arrow has many language implementations. We can't assume that all new contributors are familiar with Python, conda and/or pip.

For example, this thread #46686 (comment) considered about new R contributors.

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

A possible direction to help both could be to leverage pixi.

I'm using it locally and in many other projects (C++/Rust/Python): it combines conda dependencies and run commands in managed environments.

Once installed (which is fairly easy IMHO), a one command pixi run lint, pixi run testetc. could download and install all required dependencies as needed, execute intermediary steps (with caching), and run the commands.
What's great is that all type of dependencies (Python itself, R, compilers...) can be pulled, on all platforms.
In the case of pre-commit, I've already set it up to lint/format with the same executable used for both one-stop command, and through pre-commit.

I'm not claiming it could handle all Arrow development cases, but it certainly make for a great on-boarding.
Using it also does not prevent from not using it.
I've been meaning to write a blog post about how I use it in development. If that seems like an interesting direction, I could come back when done, and will be willing to contribute a configuration.

@kou

kou commented Jul 25, 2025

Copy link
Copy Markdown
Member

I don't have a strong opinion how to care about new contributors. I don't object the Pixi (or pip) approach if we have the official document how to prepare pre-commit with Pixi or something.
I chose the supporting system pre-commit approach just because we don't need to write additional document how to prepare pre-commit.

It may be better that we start a discussion thread on dev@arrow.apache.orghttps://lists.apache.org/list.html?dev@arrow.apache.org to collect more opinions.

@zanmato1984

Copy link
Copy Markdown
Contributor

I think it becomes more reasonable now to move forward this PR, since:

  1. We have officially upgraded to C++20, which already requires a more recent clang (GH-45885: [C++] Require C++20 #48414). Actually we are using v18 in our CI ([1] [2]).
  2. I added several concepts in GH-46063: [C++][Compute] Fix the issue that MinMax kernel emits -inf/inf for all-NaN input #48459 ([3]), which is formatted differently between current v14 (in precommit) and v15+ (in my local). This is quite annoying and I had to manually modify it to match the required v14 format. The clang-format behavior change wrt C++20 concepts can be found in [4] [5].

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting. @kou@pitrou@AntoinePrv what do you think?

Thanks.

[1]

clang-tools: 18

[2]

arrow/.env

Line 60 in 7fe39d4

CLANG_TOOLS=18

[3]
template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

[4] llvm/llvm-project#56283
[5] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

@pitrou

Copy link
Copy Markdown
Member

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting.

That's fine with me on the principle. The lint CI job is failing, though.

@kou

kou commented Jan 11, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

@zanmato1984

Copy link
Copy Markdown
Contributor

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

Thanks.

@kou

kou commented Jan 12, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

(I'm OK with what is documented. We require Ubuntu 24.04, we require pip/conda/..., or something.)

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

@zanmato1984

Copy link
Copy Markdown
Contributor

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right? Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

Thanks a lot! Let me try this.

@kou

kou commented Jan 13, 2026

Copy link
Copy Markdown
Member

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right?

Yes, if a user installs pre-commit by themselves. (A user can't install pre-commit by apt install. It's old for this PR's configuration.)

Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

Yes. We can use apt install pre-commit to install pre-commit for Apache Arrow on Ubuntu 24.04. I don't have a strong opinion what is documented as I said before: #47168 (comment)
I just thought that requiring Ubuntu 24.04 may be easier to be documented. I'm OK with other approach such as using pip or conda.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou for clarifying! I agree that requiring Ubuntu 24.04 might be easiest in terms of documentation. I personally also think this might not be a big deal for developers, since I personal haven't been using precommit at all until very recently I started to work on this PR. In other words, those developers who don't use precommit may not feel it at all.

@zanmato1984

Copy link
Copy Markdown
Contributor

Hi @kou@pitrou , shall we move on with this one? We can later add documentation wrt the required Ubuntu version for developers.

Thanks. cc @AntoinePrv

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm giving my +1 now. But obviously I'll need at least one other approval.

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 13, 2026
kou
kou approved these changes Jan 13, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 13, 2026

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, the formatting changes are for the better IMHO

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou .

  • Could you open an issue if we want to defer documentation?

Yes, #48850 filed.

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for picking up the work @zanmato1984

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

The biggest blocker for was with pre-commit (recent clang-format hooks did not support earlier versions), apart from that I don't see why not go to the most recent (for me that is better because I constrain the clangd LSP I use to the version of clang-format used in Arrow so that my editor formatting does not diverge).
But yes, most important is that all versions match in Arrow CI.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you all. Let me merge this.

@zanmato1984
zanmato1984 merged commit a1ec5a9 into apache:mainJan 14, 2026
54 checks passed
@zanmato1984zanmato1984 removed the awaiting merge Awaiting merge label Jan 14, 2026
@AntoinePrv
AntoinePrv deleted the fmt branch January 14, 2026 11:02
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a1ec5a9.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
Update clang-format to better match modern IDEs.
### What changes are included in this PR?
- Update clang-format
- Reformat code base with newer version
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: apache#47167
Lead-authored-by: AntoinePrv <AntoinePrv@users.noreply.github.com>
Co-authored-by: Rossi Sun <zanmato1984@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@raulcd@kou@zanmato1984@pitrou
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

GH-47167: [C++][Dev] Update clang-format dependency - #47168

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt
Jan 14, 2026
Merged

GH-47167: [C++][Dev] Update clang-format dependency#47168
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Update clang-format to better match modern IDEs.

What changes are included in this PR?

  • Update clang-format
  • Reformat code base with newer version

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #47167has been automatically assigned in GitHub to PR creator.

@raulcd

Copy link
Copy Markdown
Member

The Python failures are unrelated, I just merged the fix on main, if you rebase they will go away.
It seems the newer clang-format pre-commit (from 16.0.0) fails on Ubuntu 22.04 because textproto was added to identify 2.5.20 but Ubuntu seems to be using indentify 2.4.10-1 (https://packages.ubuntu.com/jammy/python3-identify).
@kou is using the system pre-commit a requirement? I am unsure what the discussion was when we moved from archery lint to pre-commit. Some info on when this was added:

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Without it, that sends back pre-commit to 15.*

@kou

kou commented Jul 23, 2025

Copy link
Copy Markdown
Member

Supporting old pre-commit (system pre-commit) is for new contributors on Ubuntu 22.04.

If we have enough documentation (or something) for new contributors, we can require more newer pre-commit (and identify).

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

pre-commit is very easy to install via either conda or pip. Are there other dependencies we are getting from these sources?

@kou

kou commented Jul 24, 2025

Copy link
Copy Markdown
Member

apache/arrow has many language implementations. We can't assume that all new contributors are familiar with Python, conda and/or pip.

For example, this thread #46686 (comment) considered about new R contributors.

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

A possible direction to help both could be to leverage pixi.

I'm using it locally and in many other projects (C++/Rust/Python): it combines conda dependencies and run commands in managed environments.

Once installed (which is fairly easy IMHO), a one command pixi run lint, pixi run testetc. could download and install all required dependencies as needed, execute intermediary steps (with caching), and run the commands.
What's great is that all type of dependencies (Python itself, R, compilers...) can be pulled, on all platforms.
In the case of pre-commit, I've already set it up to lint/format with the same executable used for both one-stop command, and through pre-commit.

I'm not claiming it could handle all Arrow development cases, but it certainly make for a great on-boarding.
Using it also does not prevent from not using it.
I've been meaning to write a blog post about how I use it in development. If that seems like an interesting direction, I could come back when done, and will be willing to contribute a configuration.

@kou

kou commented Jul 25, 2025

Copy link
Copy Markdown
Member

I don't have a strong opinion how to care about new contributors. I don't object the Pixi (or pip) approach if we have the official document how to prepare pre-commit with Pixi or something.
I chose the supporting system pre-commit approach just because we don't need to write additional document how to prepare pre-commit.

It may be better that we start a discussion thread on dev@arrow.apache.orghttps://lists.apache.org/list.html?dev@arrow.apache.org to collect more opinions.

@zanmato1984

Copy link
Copy Markdown
Contributor

I think it becomes more reasonable now to move forward this PR, since:

  1. We have officially upgraded to C++20, which already requires a more recent clang (GH-45885: [C++] Require C++20 #48414). Actually we are using v18 in our CI ([1] [2]).
  2. I added several concepts in GH-46063: [C++][Compute] Fix the issue that MinMax kernel emits -inf/inf for all-NaN input #48459 ([3]), which is formatted differently between current v14 (in precommit) and v15+ (in my local). This is quite annoying and I had to manually modify it to match the required v14 format. The clang-format behavior change wrt C++20 concepts can be found in [4] [5].

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting. @kou@pitrou@AntoinePrv what do you think?

Thanks.

[1]

clang-tools: 18

[2]

arrow/.env

Line 60 in 7fe39d4

CLANG_TOOLS=18

[3]
template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

[4] llvm/llvm-project#56283
[5] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

@pitrou

Copy link
Copy Markdown
Member

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting.

That's fine with me on the principle. The lint CI job is failing, though.

@kou

kou commented Jan 11, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

@zanmato1984

Copy link
Copy Markdown
Contributor

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

Thanks.

@kou

kou commented Jan 12, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

(I'm OK with what is documented. We require Ubuntu 24.04, we require pip/conda/..., or something.)

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

@zanmato1984

Copy link
Copy Markdown
Contributor

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right? Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

Thanks a lot! Let me try this.

@kou

kou commented Jan 13, 2026

Copy link
Copy Markdown
Member

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right?

Yes, if a user installs pre-commit by themselves. (A user can't install pre-commit by apt install. It's old for this PR's configuration.)

Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

Yes. We can use apt install pre-commit to install pre-commit for Apache Arrow on Ubuntu 24.04. I don't have a strong opinion what is documented as I said before: #47168 (comment)
I just thought that requiring Ubuntu 24.04 may be easier to be documented. I'm OK with other approach such as using pip or conda.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou for clarifying! I agree that requiring Ubuntu 24.04 might be easiest in terms of documentation. I personally also think this might not be a big deal for developers, since I personal haven't been using precommit at all until very recently I started to work on this PR. In other words, those developers who don't use precommit may not feel it at all.

@zanmato1984

Copy link
Copy Markdown
Contributor

Hi @kou@pitrou , shall we move on with this one? We can later add documentation wrt the required Ubuntu version for developers.

Thanks. cc @AntoinePrv

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm giving my +1 now. But obviously I'll need at least one other approval.

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 13, 2026
kou
kou approved these changes Jan 13, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 13, 2026

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, the formatting changes are for the better IMHO

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou .

  • Could you open an issue if we want to defer documentation?

Yes, #48850 filed.

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for picking up the work @zanmato1984

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

The biggest blocker for was with pre-commit (recent clang-format hooks did not support earlier versions), apart from that I don't see why not go to the most recent (for me that is better because I constrain the clangd LSP I use to the version of clang-format used in Arrow so that my editor formatting does not diverge).
But yes, most important is that all versions match in Arrow CI.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you all. Let me merge this.

@zanmato1984
zanmato1984 merged commit a1ec5a9 into apache:mainJan 14, 2026
54 checks passed
@zanmato1984zanmato1984 removed the awaiting merge Awaiting merge label Jan 14, 2026
@AntoinePrv
AntoinePrv deleted the fmt branch January 14, 2026 11:02
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a1ec5a9.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
Update clang-format to better match modern IDEs.
### What changes are included in this PR?
- Update clang-format
- Reformat code base with newer version
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: apache#47167
Lead-authored-by: AntoinePrv <AntoinePrv@users.noreply.github.com>
Co-authored-by: Rossi Sun <zanmato1984@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@raulcd@kou@zanmato1984@pitrou
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

GH-47167: [C++][Dev] Update clang-format dependency - #47168

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt
Jan 14, 2026
Merged

GH-47167: [C++][Dev] Update clang-format dependency#47168
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Update clang-format to better match modern IDEs.

What changes are included in this PR?

  • Update clang-format
  • Reformat code base with newer version

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #47167has been automatically assigned in GitHub to PR creator.

@raulcd

Copy link
Copy Markdown
Member

The Python failures are unrelated, I just merged the fix on main, if you rebase they will go away.
It seems the newer clang-format pre-commit (from 16.0.0) fails on Ubuntu 22.04 because textproto was added to identify 2.5.20 but Ubuntu seems to be using indentify 2.4.10-1 (https://packages.ubuntu.com/jammy/python3-identify).
@kou is using the system pre-commit a requirement? I am unsure what the discussion was when we moved from archery lint to pre-commit. Some info on when this was added:

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Without it, that sends back pre-commit to 15.*

@kou

kou commented Jul 23, 2025

Copy link
Copy Markdown
Member

Supporting old pre-commit (system pre-commit) is for new contributors on Ubuntu 22.04.

If we have enough documentation (or something) for new contributors, we can require more newer pre-commit (and identify).

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

pre-commit is very easy to install via either conda or pip. Are there other dependencies we are getting from these sources?

@kou

kou commented Jul 24, 2025

Copy link
Copy Markdown
Member

apache/arrow has many language implementations. We can't assume that all new contributors are familiar with Python, conda and/or pip.

For example, this thread #46686 (comment) considered about new R contributors.

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

A possible direction to help both could be to leverage pixi.

I'm using it locally and in many other projects (C++/Rust/Python): it combines conda dependencies and run commands in managed environments.

Once installed (which is fairly easy IMHO), a one command pixi run lint, pixi run testetc. could download and install all required dependencies as needed, execute intermediary steps (with caching), and run the commands.
What's great is that all type of dependencies (Python itself, R, compilers...) can be pulled, on all platforms.
In the case of pre-commit, I've already set it up to lint/format with the same executable used for both one-stop command, and through pre-commit.

I'm not claiming it could handle all Arrow development cases, but it certainly make for a great on-boarding.
Using it also does not prevent from not using it.
I've been meaning to write a blog post about how I use it in development. If that seems like an interesting direction, I could come back when done, and will be willing to contribute a configuration.

@kou

kou commented Jul 25, 2025

Copy link
Copy Markdown
Member

I don't have a strong opinion how to care about new contributors. I don't object the Pixi (or pip) approach if we have the official document how to prepare pre-commit with Pixi or something.
I chose the supporting system pre-commit approach just because we don't need to write additional document how to prepare pre-commit.

It may be better that we start a discussion thread on dev@arrow.apache.orghttps://lists.apache.org/list.html?dev@arrow.apache.org to collect more opinions.

@zanmato1984

Copy link
Copy Markdown
Contributor

I think it becomes more reasonable now to move forward this PR, since:

  1. We have officially upgraded to C++20, which already requires a more recent clang (GH-45885: [C++] Require C++20 #48414). Actually we are using v18 in our CI ([1] [2]).
  2. I added several concepts in GH-46063: [C++][Compute] Fix the issue that MinMax kernel emits -inf/inf for all-NaN input #48459 ([3]), which is formatted differently between current v14 (in precommit) and v15+ (in my local). This is quite annoying and I had to manually modify it to match the required v14 format. The clang-format behavior change wrt C++20 concepts can be found in [4] [5].

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting. @kou@pitrou@AntoinePrv what do you think?

Thanks.

[1]

clang-tools: 18

[2]

arrow/.env

Line 60 in 7fe39d4

CLANG_TOOLS=18

[3]
template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

[4] llvm/llvm-project#56283
[5] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

@pitrou

Copy link
Copy Markdown
Member

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting.

That's fine with me on the principle. The lint CI job is failing, though.

@kou

kou commented Jan 11, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

@zanmato1984

Copy link
Copy Markdown
Contributor

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

Thanks.

@kou

kou commented Jan 12, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

(I'm OK with what is documented. We require Ubuntu 24.04, we require pip/conda/..., or something.)

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

@zanmato1984

Copy link
Copy Markdown
Contributor

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right? Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

Thanks a lot! Let me try this.

@kou

kou commented Jan 13, 2026

Copy link
Copy Markdown
Member

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right?

Yes, if a user installs pre-commit by themselves. (A user can't install pre-commit by apt install. It's old for this PR's configuration.)

Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

Yes. We can use apt install pre-commit to install pre-commit for Apache Arrow on Ubuntu 24.04. I don't have a strong opinion what is documented as I said before: #47168 (comment)
I just thought that requiring Ubuntu 24.04 may be easier to be documented. I'm OK with other approach such as using pip or conda.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou for clarifying! I agree that requiring Ubuntu 24.04 might be easiest in terms of documentation. I personally also think this might not be a big deal for developers, since I personal haven't been using precommit at all until very recently I started to work on this PR. In other words, those developers who don't use precommit may not feel it at all.

@zanmato1984

Copy link
Copy Markdown
Contributor

Hi @kou@pitrou , shall we move on with this one? We can later add documentation wrt the required Ubuntu version for developers.

Thanks. cc @AntoinePrv

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm giving my +1 now. But obviously I'll need at least one other approval.

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 13, 2026
kou
kou approved these changes Jan 13, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 13, 2026

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, the formatting changes are for the better IMHO

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou .

  • Could you open an issue if we want to defer documentation?

Yes, #48850 filed.

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for picking up the work @zanmato1984

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

The biggest blocker for was with pre-commit (recent clang-format hooks did not support earlier versions), apart from that I don't see why not go to the most recent (for me that is better because I constrain the clangd LSP I use to the version of clang-format used in Arrow so that my editor formatting does not diverge).
But yes, most important is that all versions match in Arrow CI.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you all. Let me merge this.

@zanmato1984
zanmato1984 merged commit a1ec5a9 into apache:mainJan 14, 2026
54 checks passed
@zanmato1984zanmato1984 removed the awaiting merge Awaiting merge label Jan 14, 2026
@AntoinePrv
AntoinePrv deleted the fmt branch January 14, 2026 11:02
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a1ec5a9.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
Update clang-format to better match modern IDEs.
### What changes are included in this PR?
- Update clang-format
- Reformat code base with newer version
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: apache#47167
Lead-authored-by: AntoinePrv <AntoinePrv@users.noreply.github.com>
Co-authored-by: Rossi Sun <zanmato1984@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@raulcd@kou@zanmato1984@pitrou
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

GH-47167: [C++][Dev] Update clang-format dependency - #47168

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt
Jan 14, 2026
Merged

GH-47167: [C++][Dev] Update clang-format dependency#47168
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Update clang-format to better match modern IDEs.

What changes are included in this PR?

  • Update clang-format
  • Reformat code base with newer version

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #47167has been automatically assigned in GitHub to PR creator.

@raulcd

Copy link
Copy Markdown
Member

The Python failures are unrelated, I just merged the fix on main, if you rebase they will go away.
It seems the newer clang-format pre-commit (from 16.0.0) fails on Ubuntu 22.04 because textproto was added to identify 2.5.20 but Ubuntu seems to be using indentify 2.4.10-1 (https://packages.ubuntu.com/jammy/python3-identify).
@kou is using the system pre-commit a requirement? I am unsure what the discussion was when we moved from archery lint to pre-commit. Some info on when this was added:

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Without it, that sends back pre-commit to 15.*

@kou

kou commented Jul 23, 2025

Copy link
Copy Markdown
Member

Supporting old pre-commit (system pre-commit) is for new contributors on Ubuntu 22.04.

If we have enough documentation (or something) for new contributors, we can require more newer pre-commit (and identify).

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

pre-commit is very easy to install via either conda or pip. Are there other dependencies we are getting from these sources?

@kou

kou commented Jul 24, 2025

Copy link
Copy Markdown
Member

apache/arrow has many language implementations. We can't assume that all new contributors are familiar with Python, conda and/or pip.

For example, this thread #46686 (comment) considered about new R contributors.

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

A possible direction to help both could be to leverage pixi.

I'm using it locally and in many other projects (C++/Rust/Python): it combines conda dependencies and run commands in managed environments.

Once installed (which is fairly easy IMHO), a one command pixi run lint, pixi run testetc. could download and install all required dependencies as needed, execute intermediary steps (with caching), and run the commands.
What's great is that all type of dependencies (Python itself, R, compilers...) can be pulled, on all platforms.
In the case of pre-commit, I've already set it up to lint/format with the same executable used for both one-stop command, and through pre-commit.

I'm not claiming it could handle all Arrow development cases, but it certainly make for a great on-boarding.
Using it also does not prevent from not using it.
I've been meaning to write a blog post about how I use it in development. If that seems like an interesting direction, I could come back when done, and will be willing to contribute a configuration.

@kou

kou commented Jul 25, 2025

Copy link
Copy Markdown
Member

I don't have a strong opinion how to care about new contributors. I don't object the Pixi (or pip) approach if we have the official document how to prepare pre-commit with Pixi or something.
I chose the supporting system pre-commit approach just because we don't need to write additional document how to prepare pre-commit.

It may be better that we start a discussion thread on dev@arrow.apache.orghttps://lists.apache.org/list.html?dev@arrow.apache.org to collect more opinions.

@zanmato1984

Copy link
Copy Markdown
Contributor

I think it becomes more reasonable now to move forward this PR, since:

  1. We have officially upgraded to C++20, which already requires a more recent clang (GH-45885: [C++] Require C++20 #48414). Actually we are using v18 in our CI ([1] [2]).
  2. I added several concepts in GH-46063: [C++][Compute] Fix the issue that MinMax kernel emits -inf/inf for all-NaN input #48459 ([3]), which is formatted differently between current v14 (in precommit) and v15+ (in my local). This is quite annoying and I had to manually modify it to match the required v14 format. The clang-format behavior change wrt C++20 concepts can be found in [4] [5].

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting. @kou@pitrou@AntoinePrv what do you think?

Thanks.

[1]

clang-tools: 18

[2]

arrow/.env

Line 60 in 7fe39d4

CLANG_TOOLS=18

[3]
template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

[4] llvm/llvm-project#56283
[5] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

@pitrou

Copy link
Copy Markdown
Member

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting.

That's fine with me on the principle. The lint CI job is failing, though.

@kou

kou commented Jan 11, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

@zanmato1984

Copy link
Copy Markdown
Contributor

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

Thanks.

@kou

kou commented Jan 12, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

(I'm OK with what is documented. We require Ubuntu 24.04, we require pip/conda/..., or something.)

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

@zanmato1984

Copy link
Copy Markdown
Contributor

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right? Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

Thanks a lot! Let me try this.

@kou

kou commented Jan 13, 2026

Copy link
Copy Markdown
Member

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right?

Yes, if a user installs pre-commit by themselves. (A user can't install pre-commit by apt install. It's old for this PR's configuration.)

Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

Yes. We can use apt install pre-commit to install pre-commit for Apache Arrow on Ubuntu 24.04. I don't have a strong opinion what is documented as I said before: #47168 (comment)
I just thought that requiring Ubuntu 24.04 may be easier to be documented. I'm OK with other approach such as using pip or conda.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou for clarifying! I agree that requiring Ubuntu 24.04 might be easiest in terms of documentation. I personally also think this might not be a big deal for developers, since I personal haven't been using precommit at all until very recently I started to work on this PR. In other words, those developers who don't use precommit may not feel it at all.

@zanmato1984

Copy link
Copy Markdown
Contributor

Hi @kou@pitrou , shall we move on with this one? We can later add documentation wrt the required Ubuntu version for developers.

Thanks. cc @AntoinePrv

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm giving my +1 now. But obviously I'll need at least one other approval.

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 13, 2026
kou
kou approved these changes Jan 13, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 13, 2026

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, the formatting changes are for the better IMHO

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou .

  • Could you open an issue if we want to defer documentation?

Yes, #48850 filed.

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for picking up the work @zanmato1984

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

The biggest blocker for was with pre-commit (recent clang-format hooks did not support earlier versions), apart from that I don't see why not go to the most recent (for me that is better because I constrain the clangd LSP I use to the version of clang-format used in Arrow so that my editor formatting does not diverge).
But yes, most important is that all versions match in Arrow CI.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you all. Let me merge this.

@zanmato1984
zanmato1984 merged commit a1ec5a9 into apache:mainJan 14, 2026
54 checks passed
@zanmato1984zanmato1984 removed the awaiting merge Awaiting merge label Jan 14, 2026
@AntoinePrv
AntoinePrv deleted the fmt branch January 14, 2026 11:02
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a1ec5a9.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
Update clang-format to better match modern IDEs.
### What changes are included in this PR?
- Update clang-format
- Reformat code base with newer version
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: apache#47167
Lead-authored-by: AntoinePrv <AntoinePrv@users.noreply.github.com>
Co-authored-by: Rossi Sun <zanmato1984@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@raulcd@kou@zanmato1984@pitrou
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

GH-47167: [C++][Dev] Update clang-format dependency - #47168

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt
Jan 14, 2026
Merged

GH-47167: [C++][Dev] Update clang-format dependency#47168
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Update clang-format to better match modern IDEs.

What changes are included in this PR?

  • Update clang-format
  • Reformat code base with newer version

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #47167has been automatically assigned in GitHub to PR creator.

@raulcd

Copy link
Copy Markdown
Member

The Python failures are unrelated, I just merged the fix on main, if you rebase they will go away.
It seems the newer clang-format pre-commit (from 16.0.0) fails on Ubuntu 22.04 because textproto was added to identify 2.5.20 but Ubuntu seems to be using indentify 2.4.10-1 (https://packages.ubuntu.com/jammy/python3-identify).
@kou is using the system pre-commit a requirement? I am unsure what the discussion was when we moved from archery lint to pre-commit. Some info on when this was added:

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Without it, that sends back pre-commit to 15.*

@kou

kou commented Jul 23, 2025

Copy link
Copy Markdown
Member

Supporting old pre-commit (system pre-commit) is for new contributors on Ubuntu 22.04.

If we have enough documentation (or something) for new contributors, we can require more newer pre-commit (and identify).

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

pre-commit is very easy to install via either conda or pip. Are there other dependencies we are getting from these sources?

@kou

kou commented Jul 24, 2025

Copy link
Copy Markdown
Member

apache/arrow has many language implementations. We can't assume that all new contributors are familiar with Python, conda and/or pip.

For example, this thread #46686 (comment) considered about new R contributors.

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

A possible direction to help both could be to leverage pixi.

I'm using it locally and in many other projects (C++/Rust/Python): it combines conda dependencies and run commands in managed environments.

Once installed (which is fairly easy IMHO), a one command pixi run lint, pixi run testetc. could download and install all required dependencies as needed, execute intermediary steps (with caching), and run the commands.
What's great is that all type of dependencies (Python itself, R, compilers...) can be pulled, on all platforms.
In the case of pre-commit, I've already set it up to lint/format with the same executable used for both one-stop command, and through pre-commit.

I'm not claiming it could handle all Arrow development cases, but it certainly make for a great on-boarding.
Using it also does not prevent from not using it.
I've been meaning to write a blog post about how I use it in development. If that seems like an interesting direction, I could come back when done, and will be willing to contribute a configuration.

@kou

kou commented Jul 25, 2025

Copy link
Copy Markdown
Member

I don't have a strong opinion how to care about new contributors. I don't object the Pixi (or pip) approach if we have the official document how to prepare pre-commit with Pixi or something.
I chose the supporting system pre-commit approach just because we don't need to write additional document how to prepare pre-commit.

It may be better that we start a discussion thread on dev@arrow.apache.orghttps://lists.apache.org/list.html?dev@arrow.apache.org to collect more opinions.

@zanmato1984

Copy link
Copy Markdown
Contributor

I think it becomes more reasonable now to move forward this PR, since:

  1. We have officially upgraded to C++20, which already requires a more recent clang (GH-45885: [C++] Require C++20 #48414). Actually we are using v18 in our CI ([1] [2]).
  2. I added several concepts in GH-46063: [C++][Compute] Fix the issue that MinMax kernel emits -inf/inf for all-NaN input #48459 ([3]), which is formatted differently between current v14 (in precommit) and v15+ (in my local). This is quite annoying and I had to manually modify it to match the required v14 format. The clang-format behavior change wrt C++20 concepts can be found in [4] [5].

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting. @kou@pitrou@AntoinePrv what do you think?

Thanks.

[1]

clang-tools: 18

[2]

arrow/.env

Line 60 in 7fe39d4

CLANG_TOOLS=18

[3]
template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

[4] llvm/llvm-project#56283
[5] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

@pitrou

Copy link
Copy Markdown
Member

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting.

That's fine with me on the principle. The lint CI job is failing, though.

@kou

kou commented Jan 11, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

@zanmato1984

Copy link
Copy Markdown
Contributor

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

Thanks.

@kou

kou commented Jan 12, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

(I'm OK with what is documented. We require Ubuntu 24.04, we require pip/conda/..., or something.)

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

@zanmato1984

Copy link
Copy Markdown
Contributor

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right? Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

Thanks a lot! Let me try this.

@kou

kou commented Jan 13, 2026

Copy link
Copy Markdown
Member

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right?

Yes, if a user installs pre-commit by themselves. (A user can't install pre-commit by apt install. It's old for this PR's configuration.)

Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

Yes. We can use apt install pre-commit to install pre-commit for Apache Arrow on Ubuntu 24.04. I don't have a strong opinion what is documented as I said before: #47168 (comment)
I just thought that requiring Ubuntu 24.04 may be easier to be documented. I'm OK with other approach such as using pip or conda.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou for clarifying! I agree that requiring Ubuntu 24.04 might be easiest in terms of documentation. I personally also think this might not be a big deal for developers, since I personal haven't been using precommit at all until very recently I started to work on this PR. In other words, those developers who don't use precommit may not feel it at all.

@zanmato1984

Copy link
Copy Markdown
Contributor

Hi @kou@pitrou , shall we move on with this one? We can later add documentation wrt the required Ubuntu version for developers.

Thanks. cc @AntoinePrv

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm giving my +1 now. But obviously I'll need at least one other approval.

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 13, 2026
kou
kou approved these changes Jan 13, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 13, 2026

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, the formatting changes are for the better IMHO

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou .

  • Could you open an issue if we want to defer documentation?

Yes, #48850 filed.

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for picking up the work @zanmato1984

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

The biggest blocker for was with pre-commit (recent clang-format hooks did not support earlier versions), apart from that I don't see why not go to the most recent (for me that is better because I constrain the clangd LSP I use to the version of clang-format used in Arrow so that my editor formatting does not diverge).
But yes, most important is that all versions match in Arrow CI.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you all. Let me merge this.

@zanmato1984
zanmato1984 merged commit a1ec5a9 into apache:mainJan 14, 2026
54 checks passed
@zanmato1984zanmato1984 removed the awaiting merge Awaiting merge label Jan 14, 2026
@AntoinePrv
AntoinePrv deleted the fmt branch January 14, 2026 11:02
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a1ec5a9.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
Update clang-format to better match modern IDEs.
### What changes are included in this PR?
- Update clang-format
- Reformat code base with newer version
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: apache#47167
Lead-authored-by: AntoinePrv <AntoinePrv@users.noreply.github.com>
Co-authored-by: Rossi Sun <zanmato1984@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@raulcd@kou@zanmato1984@pitrou
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

GH-47167: [C++][Dev] Update clang-format dependency - #47168

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt
Jan 14, 2026
Merged

GH-47167: [C++][Dev] Update clang-format dependency#47168
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Update clang-format to better match modern IDEs.

What changes are included in this PR?

  • Update clang-format
  • Reformat code base with newer version

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #47167has been automatically assigned in GitHub to PR creator.

@raulcd

Copy link
Copy Markdown
Member

The Python failures are unrelated, I just merged the fix on main, if you rebase they will go away.
It seems the newer clang-format pre-commit (from 16.0.0) fails on Ubuntu 22.04 because textproto was added to identify 2.5.20 but Ubuntu seems to be using indentify 2.4.10-1 (https://packages.ubuntu.com/jammy/python3-identify).
@kou is using the system pre-commit a requirement? I am unsure what the discussion was when we moved from archery lint to pre-commit. Some info on when this was added:

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Without it, that sends back pre-commit to 15.*

@kou

kou commented Jul 23, 2025

Copy link
Copy Markdown
Member

Supporting old pre-commit (system pre-commit) is for new contributors on Ubuntu 22.04.

If we have enough documentation (or something) for new contributors, we can require more newer pre-commit (and identify).

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

pre-commit is very easy to install via either conda or pip. Are there other dependencies we are getting from these sources?

@kou

kou commented Jul 24, 2025

Copy link
Copy Markdown
Member

apache/arrow has many language implementations. We can't assume that all new contributors are familiar with Python, conda and/or pip.

For example, this thread #46686 (comment) considered about new R contributors.

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

A possible direction to help both could be to leverage pixi.

I'm using it locally and in many other projects (C++/Rust/Python): it combines conda dependencies and run commands in managed environments.

Once installed (which is fairly easy IMHO), a one command pixi run lint, pixi run testetc. could download and install all required dependencies as needed, execute intermediary steps (with caching), and run the commands.
What's great is that all type of dependencies (Python itself, R, compilers...) can be pulled, on all platforms.
In the case of pre-commit, I've already set it up to lint/format with the same executable used for both one-stop command, and through pre-commit.

I'm not claiming it could handle all Arrow development cases, but it certainly make for a great on-boarding.
Using it also does not prevent from not using it.
I've been meaning to write a blog post about how I use it in development. If that seems like an interesting direction, I could come back when done, and will be willing to contribute a configuration.

@kou

kou commented Jul 25, 2025

Copy link
Copy Markdown
Member

I don't have a strong opinion how to care about new contributors. I don't object the Pixi (or pip) approach if we have the official document how to prepare pre-commit with Pixi or something.
I chose the supporting system pre-commit approach just because we don't need to write additional document how to prepare pre-commit.

It may be better that we start a discussion thread on dev@arrow.apache.orghttps://lists.apache.org/list.html?dev@arrow.apache.org to collect more opinions.

@zanmato1984

Copy link
Copy Markdown
Contributor

I think it becomes more reasonable now to move forward this PR, since:

  1. We have officially upgraded to C++20, which already requires a more recent clang (GH-45885: [C++] Require C++20 #48414). Actually we are using v18 in our CI ([1] [2]).
  2. I added several concepts in GH-46063: [C++][Compute] Fix the issue that MinMax kernel emits -inf/inf for all-NaN input #48459 ([3]), which is formatted differently between current v14 (in precommit) and v15+ (in my local). This is quite annoying and I had to manually modify it to match the required v14 format. The clang-format behavior change wrt C++20 concepts can be found in [4] [5].

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting. @kou@pitrou@AntoinePrv what do you think?

Thanks.

[1]

clang-tools: 18

[2]

arrow/.env

Line 60 in 7fe39d4

CLANG_TOOLS=18

[3]
template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

[4] llvm/llvm-project#56283
[5] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

@pitrou

Copy link
Copy Markdown
Member

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting.

That's fine with me on the principle. The lint CI job is failing, though.

@kou

kou commented Jan 11, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

@zanmato1984

Copy link
Copy Markdown
Contributor

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

Thanks.

@kou

kou commented Jan 12, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

(I'm OK with what is documented. We require Ubuntu 24.04, we require pip/conda/..., or something.)

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

@zanmato1984

Copy link
Copy Markdown
Contributor

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right? Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

Thanks a lot! Let me try this.

@kou

kou commented Jan 13, 2026

Copy link
Copy Markdown
Member

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right?

Yes, if a user installs pre-commit by themselves. (A user can't install pre-commit by apt install. It's old for this PR's configuration.)

Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

Yes. We can use apt install pre-commit to install pre-commit for Apache Arrow on Ubuntu 24.04. I don't have a strong opinion what is documented as I said before: #47168 (comment)
I just thought that requiring Ubuntu 24.04 may be easier to be documented. I'm OK with other approach such as using pip or conda.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou for clarifying! I agree that requiring Ubuntu 24.04 might be easiest in terms of documentation. I personally also think this might not be a big deal for developers, since I personal haven't been using precommit at all until very recently I started to work on this PR. In other words, those developers who don't use precommit may not feel it at all.

@zanmato1984

Copy link
Copy Markdown
Contributor

Hi @kou@pitrou , shall we move on with this one? We can later add documentation wrt the required Ubuntu version for developers.

Thanks. cc @AntoinePrv

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm giving my +1 now. But obviously I'll need at least one other approval.

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 13, 2026
kou
kou approved these changes Jan 13, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 13, 2026

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, the formatting changes are for the better IMHO

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou .

  • Could you open an issue if we want to defer documentation?

Yes, #48850 filed.

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for picking up the work @zanmato1984

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

The biggest blocker for was with pre-commit (recent clang-format hooks did not support earlier versions), apart from that I don't see why not go to the most recent (for me that is better because I constrain the clangd LSP I use to the version of clang-format used in Arrow so that my editor formatting does not diverge).
But yes, most important is that all versions match in Arrow CI.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you all. Let me merge this.

@zanmato1984
zanmato1984 merged commit a1ec5a9 into apache:mainJan 14, 2026
54 checks passed
@zanmato1984zanmato1984 removed the awaiting merge Awaiting merge label Jan 14, 2026
@AntoinePrv
AntoinePrv deleted the fmt branch January 14, 2026 11:02
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a1ec5a9.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
Update clang-format to better match modern IDEs.
### What changes are included in this PR?
- Update clang-format
- Reformat code base with newer version
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: apache#47167
Lead-authored-by: AntoinePrv <AntoinePrv@users.noreply.github.com>
Co-authored-by: Rossi Sun <zanmato1984@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@raulcd@kou@zanmato1984@pitrou
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

GH-47167: [C++][Dev] Update clang-format dependency - #47168

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt
Jan 14, 2026
Merged

GH-47167: [C++][Dev] Update clang-format dependency#47168
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Update clang-format to better match modern IDEs.

What changes are included in this PR?

  • Update clang-format
  • Reformat code base with newer version

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #47167has been automatically assigned in GitHub to PR creator.

@raulcd

Copy link
Copy Markdown
Member

The Python failures are unrelated, I just merged the fix on main, if you rebase they will go away.
It seems the newer clang-format pre-commit (from 16.0.0) fails on Ubuntu 22.04 because textproto was added to identify 2.5.20 but Ubuntu seems to be using indentify 2.4.10-1 (https://packages.ubuntu.com/jammy/python3-identify).
@kou is using the system pre-commit a requirement? I am unsure what the discussion was when we moved from archery lint to pre-commit. Some info on when this was added:

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Without it, that sends back pre-commit to 15.*

@kou

kou commented Jul 23, 2025

Copy link
Copy Markdown
Member

Supporting old pre-commit (system pre-commit) is for new contributors on Ubuntu 22.04.

If we have enough documentation (or something) for new contributors, we can require more newer pre-commit (and identify).

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

pre-commit is very easy to install via either conda or pip. Are there other dependencies we are getting from these sources?

@kou

kou commented Jul 24, 2025

Copy link
Copy Markdown
Member

apache/arrow has many language implementations. We can't assume that all new contributors are familiar with Python, conda and/or pip.

For example, this thread #46686 (comment) considered about new R contributors.

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

A possible direction to help both could be to leverage pixi.

I'm using it locally and in many other projects (C++/Rust/Python): it combines conda dependencies and run commands in managed environments.

Once installed (which is fairly easy IMHO), a one command pixi run lint, pixi run testetc. could download and install all required dependencies as needed, execute intermediary steps (with caching), and run the commands.
What's great is that all type of dependencies (Python itself, R, compilers...) can be pulled, on all platforms.
In the case of pre-commit, I've already set it up to lint/format with the same executable used for both one-stop command, and through pre-commit.

I'm not claiming it could handle all Arrow development cases, but it certainly make for a great on-boarding.
Using it also does not prevent from not using it.
I've been meaning to write a blog post about how I use it in development. If that seems like an interesting direction, I could come back when done, and will be willing to contribute a configuration.

@kou

kou commented Jul 25, 2025

Copy link
Copy Markdown
Member

I don't have a strong opinion how to care about new contributors. I don't object the Pixi (or pip) approach if we have the official document how to prepare pre-commit with Pixi or something.
I chose the supporting system pre-commit approach just because we don't need to write additional document how to prepare pre-commit.

It may be better that we start a discussion thread on dev@arrow.apache.orghttps://lists.apache.org/list.html?dev@arrow.apache.org to collect more opinions.

@zanmato1984

Copy link
Copy Markdown
Contributor

I think it becomes more reasonable now to move forward this PR, since:

  1. We have officially upgraded to C++20, which already requires a more recent clang (GH-45885: [C++] Require C++20 #48414). Actually we are using v18 in our CI ([1] [2]).
  2. I added several concepts in GH-46063: [C++][Compute] Fix the issue that MinMax kernel emits -inf/inf for all-NaN input #48459 ([3]), which is formatted differently between current v14 (in precommit) and v15+ (in my local). This is quite annoying and I had to manually modify it to match the required v14 format. The clang-format behavior change wrt C++20 concepts can be found in [4] [5].

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting. @kou@pitrou@AntoinePrv what do you think?

Thanks.

[1]

clang-tools: 18

[2]

arrow/.env

Line 60 in 7fe39d4

CLANG_TOOLS=18

[3]
template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

[4] llvm/llvm-project#56283
[5] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

@pitrou

Copy link
Copy Markdown
Member

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting.

That's fine with me on the principle. The lint CI job is failing, though.

@kou

kou commented Jan 11, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

@zanmato1984

Copy link
Copy Markdown
Contributor

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

Thanks.

@kou

kou commented Jan 12, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

(I'm OK with what is documented. We require Ubuntu 24.04, we require pip/conda/..., or something.)

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

@zanmato1984

Copy link
Copy Markdown
Contributor

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right? Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

Thanks a lot! Let me try this.

@kou

kou commented Jan 13, 2026

Copy link
Copy Markdown
Member

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right?

Yes, if a user installs pre-commit by themselves. (A user can't install pre-commit by apt install. It's old for this PR's configuration.)

Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

Yes. We can use apt install pre-commit to install pre-commit for Apache Arrow on Ubuntu 24.04. I don't have a strong opinion what is documented as I said before: #47168 (comment)
I just thought that requiring Ubuntu 24.04 may be easier to be documented. I'm OK with other approach such as using pip or conda.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou for clarifying! I agree that requiring Ubuntu 24.04 might be easiest in terms of documentation. I personally also think this might not be a big deal for developers, since I personal haven't been using precommit at all until very recently I started to work on this PR. In other words, those developers who don't use precommit may not feel it at all.

@zanmato1984

Copy link
Copy Markdown
Contributor

Hi @kou@pitrou , shall we move on with this one? We can later add documentation wrt the required Ubuntu version for developers.

Thanks. cc @AntoinePrv

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm giving my +1 now. But obviously I'll need at least one other approval.

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 13, 2026
kou
kou approved these changes Jan 13, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 13, 2026

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, the formatting changes are for the better IMHO

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou .

  • Could you open an issue if we want to defer documentation?

Yes, #48850 filed.

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for picking up the work @zanmato1984

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

The biggest blocker for was with pre-commit (recent clang-format hooks did not support earlier versions), apart from that I don't see why not go to the most recent (for me that is better because I constrain the clangd LSP I use to the version of clang-format used in Arrow so that my editor formatting does not diverge).
But yes, most important is that all versions match in Arrow CI.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you all. Let me merge this.

@zanmato1984
zanmato1984 merged commit a1ec5a9 into apache:mainJan 14, 2026
54 checks passed
@zanmato1984zanmato1984 removed the awaiting merge Awaiting merge label Jan 14, 2026
@AntoinePrv
AntoinePrv deleted the fmt branch January 14, 2026 11:02
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a1ec5a9.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
Update clang-format to better match modern IDEs.
### What changes are included in this PR?
- Update clang-format
- Reformat code base with newer version
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: apache#47167
Lead-authored-by: AntoinePrv <AntoinePrv@users.noreply.github.com>
Co-authored-by: Rossi Sun <zanmato1984@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@raulcd@kou@zanmato1984@pitrou
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

GH-47167: [C++][Dev] Update clang-format dependency - #47168

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt
Jan 14, 2026
Merged

GH-47167: [C++][Dev] Update clang-format dependency#47168
zanmato1984 merged 5 commits into
apache:mainfrom
AntoinePrv:fmt

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Update clang-format to better match modern IDEs.

What changes are included in this PR?

  • Update clang-format
  • Reformat code base with newer version

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #47167has been automatically assigned in GitHub to PR creator.

@raulcd

Copy link
Copy Markdown
Member

The Python failures are unrelated, I just merged the fix on main, if you rebase they will go away.
It seems the newer clang-format pre-commit (from 16.0.0) fails on Ubuntu 22.04 because textproto was added to identify 2.5.20 but Ubuntu seems to be using indentify 2.4.10-1 (https://packages.ubuntu.com/jammy/python3-identify).
@kou is using the system pre-commit a requirement? I am unsure what the discussion was when we moved from archery lint to pre-commit. Some info on when this was added:

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Without it, that sends back pre-commit to 15.*

@kou

kou commented Jul 23, 2025

Copy link
Copy Markdown
Member

Supporting old pre-commit (system pre-commit) is for new contributors on Ubuntu 22.04.

If we have enough documentation (or something) for new contributors, we can require more newer pre-commit (and identify).

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

pre-commit is very easy to install via either conda or pip. Are there other dependencies we are getting from these sources?

@kou

kou commented Jul 24, 2025

Copy link
Copy Markdown
Member

apache/arrow has many language implementations. We can't assume that all new contributors are familiar with Python, conda and/or pip.

For example, this thread #46686 (comment) considered about new R contributors.

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

A possible direction to help both could be to leverage pixi.

I'm using it locally and in many other projects (C++/Rust/Python): it combines conda dependencies and run commands in managed environments.

Once installed (which is fairly easy IMHO), a one command pixi run lint, pixi run testetc. could download and install all required dependencies as needed, execute intermediary steps (with caching), and run the commands.
What's great is that all type of dependencies (Python itself, R, compilers...) can be pulled, on all platforms.
In the case of pre-commit, I've already set it up to lint/format with the same executable used for both one-stop command, and through pre-commit.

I'm not claiming it could handle all Arrow development cases, but it certainly make for a great on-boarding.
Using it also does not prevent from not using it.
I've been meaning to write a blog post about how I use it in development. If that seems like an interesting direction, I could come back when done, and will be willing to contribute a configuration.

@kou

kou commented Jul 25, 2025

Copy link
Copy Markdown
Member

I don't have a strong opinion how to care about new contributors. I don't object the Pixi (or pip) approach if we have the official document how to prepare pre-commit with Pixi or something.
I chose the supporting system pre-commit approach just because we don't need to write additional document how to prepare pre-commit.

It may be better that we start a discussion thread on dev@arrow.apache.orghttps://lists.apache.org/list.html?dev@arrow.apache.org to collect more opinions.

@zanmato1984

Copy link
Copy Markdown
Contributor

I think it becomes more reasonable now to move forward this PR, since:

  1. We have officially upgraded to C++20, which already requires a more recent clang (GH-45885: [C++] Require C++20 #48414). Actually we are using v18 in our CI ([1] [2]).
  2. I added several concepts in GH-46063: [C++][Compute] Fix the issue that MinMax kernel emits -inf/inf for all-NaN input #48459 ([3]), which is formatted differently between current v14 (in precommit) and v15+ (in my local). This is quite annoying and I had to manually modify it to match the required v14 format. The clang-format behavior change wrt C++20 concepts can be found in [4] [5].

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting. @kou@pitrou@AntoinePrv what do you think?

Thanks.

[1]

clang-tools: 18

[2]

arrow/.env

Line 60 in 7fe39d4

CLANG_TOOLS=18

[3]
template <typename T>
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;

[4] llvm/llvm-project#56283
[5] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

@pitrou

Copy link
Copy Markdown
Member

I've made a commit in this PR with an update to the clang-format version change from v20 to a less aggressive v18, and related code formatting.

That's fine with me on the principle. The lint CI job is failing, though.

@kou

kou commented Jan 11, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

@zanmato1984

Copy link
Copy Markdown
Contributor

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

Thanks.

@kou

kou commented Jan 12, 2026

Copy link
Copy Markdown
Member

How about requiring (recommending?) Ubuntu 24.04 or later (not 22.04) for development in our documentation?

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

(I'm OK with what is documented. We require Ubuntu 24.04, we require pip/conda/..., or something.)

Another question is, other than clarifying in the document, what else need to be changed to let the CI pass?

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

@zanmato1984

Copy link
Copy Markdown
Contributor

Is this because we want to have a system that has defaulted precommit/clang-format that matches the latest requirement?

It's for only pre-commit. We don't need to care about clang-format version. pre-commit installs clang-format automatically.

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right? Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index b763cfbbbc..59171ddcaa 100644
--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -41,8 +41,8 @@ jobs:
lint:
name: Lint C++, Python, R, Docker, RAT
- # Use Ubuntu 22.04 to ensure working pre-commit on Ubuntu 22.04.- runs-on: ubuntu-22.04+ # Use Ubuntu 24.04 to ensure working pre-commit on Ubuntu 24.04.+ runs-on: ubuntu-24.04
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 15
steps:

Thanks a lot! Let me try this.

@kou

kou commented Jan 13, 2026

Copy link
Copy Markdown
Member

Oh, I mean even on older Ubuntu we can still have a recent-enough pre-commit, right?

Yes, if a user installs pre-commit by themselves. (A user can't install pre-commit by apt install. It's old for this PR's configuration.)

Why does this have anything to do with the version of Ubuntu? (Is it because on Ubuntu 24.04, the defaulted pre-commit is recent-enough, so people don't have to install one?)

Yes. We can use apt install pre-commit to install pre-commit for Apache Arrow on Ubuntu 24.04. I don't have a strong opinion what is documented as I said before: #47168 (comment)
I just thought that requiring Ubuntu 24.04 may be easier to be documented. I'm OK with other approach such as using pip or conda.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou for clarifying! I agree that requiring Ubuntu 24.04 might be easiest in terms of documentation. I personally also think this might not be a big deal for developers, since I personal haven't been using precommit at all until very recently I started to work on this PR. In other words, those developers who don't use precommit may not feel it at all.

@zanmato1984

Copy link
Copy Markdown
Contributor

Hi @kou@pitrou , shall we move on with this one? We can later add documentation wrt the required Ubuntu version for developers.

Thanks. cc @AntoinePrv

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm giving my +1 now. But obviously I'll need at least one other approval.

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 13, 2026
kou
kou approved these changes Jan 13, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 13, 2026

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, the formatting changes are for the better IMHO

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you @kou .

  • Could you open an issue if we want to defer documentation?

Yes, #48850 filed.

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for picking up the work @zanmato1984

I used v18 to match the version used in the rest of our CI, see #47168 (comment) .

The biggest blocker for was with pre-commit (recent clang-format hooks did not support earlier versions), apart from that I don't see why not go to the most recent (for me that is better because I constrain the clangd LSP I use to the version of clang-format used in Arrow so that my editor formatting does not diverge).
But yes, most important is that all versions match in Arrow CI.

@zanmato1984

Copy link
Copy Markdown
Contributor

Thank you all. Let me merge this.

@zanmato1984
zanmato1984 merged commit a1ec5a9 into apache:mainJan 14, 2026
54 checks passed
@zanmato1984zanmato1984 removed the awaiting merge Awaiting merge label Jan 14, 2026
@AntoinePrv
AntoinePrv deleted the fmt branch January 14, 2026 11:02
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a1ec5a9.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
shashbha14 pushed a commit to shashbha14/arrow that referenced this pull request Jan 16, 2026
…t/Ubuntu
This commit adds a new 'Development Tool Requirements' section to the C++ development documentation that clearly specifies:
- clang-format version 14.0.6 or later
- pre-commit version 2.17.0 or later
- Ubuntu 22.04 LTS or later
These requirements reflect the toolchain updates made in apacheGH-47168.
Fixesapache#48850
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
### Rationale for this change
Update clang-format to better match modern IDEs.
### What changes are included in this PR?
- Update clang-format
- Reformat code base with newer version
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: apache#47167
Lead-authored-by: AntoinePrv <AntoinePrv@users.noreply.github.com>
Co-authored-by: Rossi Sun <zanmato1984@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@raulcd@kou@zanmato1984@pitrou