Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-45820: [C++] Add optional out_offset for Buffer-returning CopyBitmap function #45852

Merged
merged 6 commits into from
Mar 19, 2025

Conversation

raulcd
Copy link
Member

@raulcd raulcd commented Mar 18, 2025

Rationale for this change

The CopyBitmap variant that returns a std::shared_ptr<Buffer> doesn't allow passing a destination bit offset for the output.

Accepting such an argument would allow using that function to replace the null bitmap of an existing array, without changing its offset.

What changes are included in this PR?

Adding the option out_offset argument.

Are these changes tested?

Yes, the existing TestCopyBitmap has been adapted to use dest_offset or not.

Are there any user-facing changes?

No, but we allow a new optional argument (out_offset) to CopyBitmap

@raulcd raulcd marked this pull request as ready for review March 18, 2025 18:04
@raulcd raulcd requested a review from pitrou March 18, 2025 18:13
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Mar 18, 2025
Comment on lines 1592 to 1595
for (bool maintan_offset : {true, false}) {
for (int64_t num_bits : lengths) {
for (int64_t offset : offsets) {
const int64_t copy_length = num_bits - offset;
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to test with different offsets, for example:

Suggested change
for (bool maintan_offset : {true, false}) {
for (int64_t num_bits : lengths) {
for (int64_t offset : offsets) {
const int64_t copy_length = num_bits - offset;
for (int64_t num_bits : lengths) {
for (int64_t offset : offsets) {
for (int64_t dest_offset : {0, offset - 1, offset + 1}) {
const int64_t copy_length = num_bits - offset;

Comment on lines 226 to 227
// As we have freshly allocated this bitmap, we should take care of zeroing the
// remaining bits.
Copy link
Member

Choose a reason for hiding this comment

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

It is actually dubious that this code is necessary, since AllocateEmptyBitmap has already zero-initialized the entire buffer. Perhaps we can try remove it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tried removing it and all tests are successful

@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Mar 19, 2025
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Mar 19, 2025
@pitrou
Copy link
Member

pitrou commented Mar 19, 2025

@github-actions crossbow submit -g cpp

Copy link

Revision: c6e8149

Submitted crossbow builds: ursacomputing/crossbow @ actions-6ed5547d68

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
test-alpine-linux-cpp GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-meson GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-cuda-cpp-ubuntu-22.04-cuda-11.7.1 GitHub Actions
test-debian-12-cpp-amd64 GitHub Actions
test-debian-12-cpp-i386 GitHub Actions
test-fedora-39-cpp GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-bundled-offline GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

@pitrou
Copy link
Member

pitrou commented Mar 19, 2025

Valgrind tests have passed, which is a confirmation that the removed code did not serve a purpose.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks for this @raulcd ! CI failures are unrelated.

@pitrou pitrou merged commit 5d487ca into apache:main Mar 19, 2025
37 of 38 checks passed
@pitrou pitrou removed the awaiting changes Awaiting changes label Mar 19, 2025
@github-actions github-actions bot added the awaiting committer review Awaiting committer review label Mar 19, 2025
Copy link

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

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 19 possible false positives for unstable benchmarks that are known to sometimes produce them.

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.

2 participants