Skip to content

GH-50636: [C++][R] Fix macOS 11.3 std::span construction in vector_sort#50651

Draft
KHARSHAVARDHAN-eng wants to merge 1 commit into
apache:mainfrom
KHARSHAVARDHAN-eng:gh-50636-fix-span-construction
Draft

GH-50636: [C++][R] Fix macOS 11.3 std::span construction in vector_sort#50651
KHARSHAVARDHAN-eng wants to merge 1 commit into
apache:mainfrom
KHARSHAVARDHAN-eng:gh-50636-fix-span-construction

Conversation

@KHARSHAVARDHAN-eng

@KHARSHAVARDHAN-eng KHARSHAVARDHAN-eng commented Jul 27, 2026

Copy link
Copy Markdown

Rationale for this change

Building Apache Arrow on macOS using older LLVM libc++ toolchains (such as Xcode 12.5 shipped with the macOS 11.3 SDK) fails when compiling the vector_sort compute kernel due to unsupported std::span range constructors.

What changes are included in this PR?

In cpp/src/arrow/compute/kernels/vector_sort_internal.h:

  • In NonStablePartitioner & StablePartitioner: Replaced non-conforming std::span<uint64_t>{middle, indices.data() + indices.size()} with indices.subspan(middle - indices.data()).
  • In ChunkedMergeImpl::MergeNullsAtStart & MergeNullsAtEnd: Replaced std::span<CompressedChunkLocation>{left.overall_begin(), right.overall_end()} with std::span<CompressedChunkLocation>{left.overall_begin(), static_cast<size_t>(right.overall_end() - left.overall_begin())}.

Both .subspan(offset) and std::span(pointer, size_type) are standard C++20 and supported on older macOS libc++ implementations.

Verification

  • Built affected compute targets successfully.
  • Built vector sort tests successfully.
  • Verified the diff only contains the intended changes.

Closes #50636

@github-actions

Copy link
Copy Markdown

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

@kou

kou commented Jul 27, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g r

@kou

kou commented Jul 27, 2026

Copy link
Copy Markdown
Member

Could you use our PR template? (You can make PR ready after it.)

Could you read https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code ?

@github-actions

Copy link
Copy Markdown

Revision: 99e8db3

Submitted crossbow builds: ursacomputing/crossbow @ actions-5c2ee98607

Task Status
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-r-alpine-linux-cran GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-fedora-clang GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-sanitizers GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-m1-san GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-offline-maximal GitHub Actions
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-r-wasm GitHub Actions

@Reranko05 Reranko05 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.

The issue description points to the std::span construction in vector_sort.cc, but this PR only changes vector_sort_internal.h. Also, the test-r-macos-as-cran Crossbow job is still failing with the same cannot convert initializer list argument to std::span<uint64_t> error in vector_sort.cc. Could you clarify how these changes resolve the compilation failure reported in GH-50636?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++][R] macOS 11.3 SDK fails to compile std::span iterator range in vector_sort

3 participants