You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by al...@apache.org on 2023/08/26 00:35:39 UTC
[datasketches-cpp] branch generate_sketches_for_java updated: added compressed theta sketches
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch generate_sketches_for_java
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git
The following commit(s) were added to refs/heads/generate_sketches_for_java by this push:
new c1509a4 added compressed theta sketches
c1509a4 is described below
commit c1509a475ca6afdd40c057f445539415188fd29f
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Fri Aug 25 17:35:28 2023 -0700
added compressed theta sketches
---
theta/test/theta_sketch_serialize_for_java.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/theta/test/theta_sketch_serialize_for_java.cpp b/theta/test/theta_sketch_serialize_for_java.cpp
index dbcbaec..7b792cc 100644
--- a/theta/test/theta_sketch_serialize_for_java.cpp
+++ b/theta/test/theta_sketch_serialize_for_java.cpp
@@ -35,6 +35,18 @@ TEST_CASE("theta sketch generate", "[serialize_for_java]") {
}
}
+TEST_CASE("theta sketch generate compressed", "[serialize_for_java]") {
+ const unsigned n_arr[] = {10, 100, 1000, 10000, 100000, 1000000};
+ for (const unsigned n: n_arr) {
+ auto sketch = update_theta_sketch::builder().build();
+ for (unsigned i = 0; i < n; ++i) sketch.update(i);
+ REQUIRE_FALSE(sketch.is_empty());
+ REQUIRE(sketch.get_estimate() == Approx(n).margin(n * 0.03));
+ std::ofstream os("theta_compressed_n" + std::to_string(n) + "_cpp.sk", std::ios::binary);
+ sketch.compact().serialize(os);
+ }
+}
+
TEST_CASE("theta sketch generate non-empty no entries", "[serialize_for_java]") {
auto sketch = update_theta_sketch::builder().set_p(0.01).build();
sketch.update(1);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org