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/06/08 21:27:51 UTC
[datasketches-java] branch kll_serde_compat created (now 1c06b76e)
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a change to branch kll_serde_compat
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git
at 1c06b76e compatibility tests
This branch includes the following new commits:
new 1c06b76e compatibility tests
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
[datasketches-java] 01/01: compatibility tests
Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch kll_serde_compat
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git
commit 1c06b76ec831f547c460902ff47fa699a08c4784
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Thu Jun 8 14:27:39 2023 -0700
compatibility tests
---
.../apache/datasketches/kll/KllDoublesSketchTest.java | 14 ++++++++++++++
.../org/apache/datasketches/kll/KllFloatsSketchTest.java | 14 ++++++++++++++
src/test/resources/kll_double_estimation_cpp.sk | Bin 0 -> 2640 bytes
src/test/resources/kll_float_estimation_cpp.sk | Bin 0 -> 1336 bytes
4 files changed, 28 insertions(+)
diff --git a/src/test/java/org/apache/datasketches/kll/KllDoublesSketchTest.java b/src/test/java/org/apache/datasketches/kll/KllDoublesSketchTest.java
index e6d1edc1..e3965e5a 100644
--- a/src/test/java/org/apache/datasketches/kll/KllDoublesSketchTest.java
+++ b/src/test/java/org/apache/datasketches/kll/KllDoublesSketchTest.java
@@ -27,8 +27,12 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
+import java.io.File;
+
import org.apache.datasketches.common.SketchesArgumentException;
+import org.apache.datasketches.common.Util;
import org.apache.datasketches.memory.DefaultMemoryRequestServer;
+import org.apache.datasketches.memory.MapHandle;
import org.apache.datasketches.memory.Memory;
import org.apache.datasketches.memory.WritableMemory;
import org.apache.datasketches.quantilescommon.DoublesSortedView;
@@ -584,6 +588,16 @@ public class KllDoublesSketchTest {
}
}
+ @Test
+ public void compatibilityWithCppEstimationMode() throws Exception {
+ final File file = Util.getResourceFile("kll_double_estimation_cpp.sk");
+ try (MapHandle mh = Memory.map(file)) {
+ final KllDoublesSketch sketch = KllDoublesSketch.heapify(mh.get());
+ assertEquals(sketch.getMinItem(), 0);
+ assertEquals(sketch.getMaxItem(), 999);
+ }
+ }
+
private final static boolean enablePrinting = false;
/**
diff --git a/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java b/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
index c6ef9466..7e38126e 100644
--- a/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
+++ b/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
@@ -28,8 +28,12 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
+import java.io.File;
+
import org.apache.datasketches.common.SketchesArgumentException;
+import org.apache.datasketches.common.Util;
import org.apache.datasketches.memory.DefaultMemoryRequestServer;
+import org.apache.datasketches.memory.MapHandle;
import org.apache.datasketches.memory.Memory;
import org.apache.datasketches.memory.WritableMemory;
import org.apache.datasketches.quantilescommon.FloatsSortedView;
@@ -586,6 +590,16 @@ public class KllFloatsSketchTest {
}
}
+ @Test
+ public void compatibilityWithCppEstimationMode() throws Exception {
+ final File file = Util.getResourceFile("kll_float_estimation_cpp.sk");
+ try (final MapHandle mh = Memory.map(file)) {
+ final KllFloatsSketch sketch = KllFloatsSketch.heapify(mh.get());
+ assertEquals(sketch.getMinItem(), 0);
+ assertEquals(sketch.getMaxItem(), 999);
+ }
+ }
+
private final static boolean enablePrinting = false;
/**
diff --git a/src/test/resources/kll_double_estimation_cpp.sk b/src/test/resources/kll_double_estimation_cpp.sk
new file mode 100644
index 00000000..8e4f1fa8
Binary files /dev/null and b/src/test/resources/kll_double_estimation_cpp.sk differ
diff --git a/src/test/resources/kll_float_estimation_cpp.sk b/src/test/resources/kll_float_estimation_cpp.sk
new file mode 100644
index 00000000..b2cf01c0
Binary files /dev/null and b/src/test/resources/kll_float_estimation_cpp.sk differ
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org