Skip to content

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

Open
rustyconover wants to merge 1 commit into
apache:masterfrom
rustyconover:fix/ebpps-merge-swap
Open

rustyconover wants to merge 1 commit into
apache:masterfrom
rustyconover:fix/ebpps-merge-swap

Conversation

@rustyconover

Copy link
Copy Markdown

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>

This branch has not been deployed

No deployments
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.

1 participant