Skip to content

Conversation

@c-dickens
Copy link
Contributor

Added bindings for Bloom filter functions

…andalone function

- Replace create_bloom_filter() function with bloom_filter.create_by_accuracy() and bloom_filter.create_by_size() static methods
- Follow repository vernacular pattern similar to other sketches
- Update tests to use new API
- Fix indentation issues in test file
- All tests passing (4/4 bloom filter tests, 37/37 other tests)
- Add reset() method to Python bloom filter wrapper
- Method clears all bits and resets filter to empty state
- Preserves filter configuration (capacity, num_hashes, seed)
- Add comprehensive unit test for reset functionality
- Test verifies empty state, bit usage reset, and post-reset operations
- Add efficient overloads for different Python data types:
  * uint64_t for non-negative integers
  * int64_t for negative/positive integers
  * double for floats
  * std::string for strings
  * bytes objects for binary data
- Use proper static_cast syntax for nanobind compatibility
- Add comprehensive unit test for all supported data types
- Remove memoryview support (not available in nanobind)
- All 16 bloom filter tests pass
- Fix bloom filter inversion test to use correct mathematical properties
- Replace probabilistic expectation for new items after inversion with double-inversion test
- Test that invert(invert(filter)) == filter, which is mathematically guaranteed
- Update invert() method documentation to match C++ implementation
- Add __repr__ method for better debugging and REPL experience
@c-dickens c-dickens marked this pull request as draft August 12, 2025 22:18
@c-dickens
Copy link
Contributor Author

I'm surprised by these unit test errors. I will check locally and see if I've missed something obvious.

@c-dickens
Copy link
Contributor Author

Had an erroneous and outdated _datasketches.so in the repo! Fixed.

@c-dickens c-dickens marked this pull request as ready for review August 13, 2025 07:29
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