Skip to content

fix: ebpps_sketch::merge(const&) called an unqualified swap - #557

Merged
proost merged 1 commit into
apache:masterfrom
rustyconover:fix/ebpps-merge-swap
Oct 29, 2026
Merged

proost merged 1 commit into
apache:masterfrom
rustyconover:fix/ebpps-merge-swap

Conversation

@rustyconover

Copy link
Copy Markdown
Contributor

When ebpps_sketch::merge(const ebpps_sketch&) merges a heavier sketch, it swaps with swap(*this, sk_copy), unqualified. That only compiles when argument-dependent lookup finds a swap through the template arguments, as it does for std::allocator. With an allocator from an application's namespace it fails:

ebpps_sketch_impl.hpp:205:9: error: 'swap' was not declared in this scope

merge(ebpps_sketch&&) already calls std::swap, so this does the same. I checked the other headers and found no other unqualified swap calls.

Test

Added ebpps merge heavier sketch by const reference with an application allocator to ebpps_allocation_test.cpp. It uses an allocator declared outside the datasketches namespace. Without the fix it doesn't compile; with it, all EBPPS tests pass (14 test cases).

We found this in the DuckDB DataSketches extension, which builds its sketches with its own allocator. Until now it worked around this by copying the sketch and merging through merge(&&).

🤖 Generated with Claude Code

The const& overload swapped with swap(*this, sk_copy), which only compiles when
argument-dependent lookup finds a swap through the template arguments. With an
allocator from an application's namespace it fails to compile. Call std::swap,
as merge(&&) already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

Thanks for fixing this!

@proost
proost merged commit 7a08fe4 into apache:master Oct 29, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants