You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2024/02/16 00:53:06 UTC
(datasketches-java) 01/01: Rename EBPPS tests to use proper nomenclature, add missing toString method
This is an automated email from the ASF dual-hosted git repository.
jmalkin pushed a commit to branch ebpps_tostring
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git
commit a33ed22de1518a85b9fffa0ebf4968817cea4afc
Author: jmalkin <78...@users.noreply.github.com>
AuthorDate: Thu Feb 15 16:52:51 2024 -0800
Rename EBPPS tests to use proper nomenclature, add missing toString method
---
.../apache/datasketches/sampling/EbppsItemsSketch.java | 16 +++++++++++++++-
.../{EbppsSampleTest.java => EbppsItemsSampleTest.java} | 0
.../{EbppsSketchTest.java => EbppsItemsSketchTest.java} | 3 +++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/datasketches/sampling/EbppsItemsSketch.java b/src/main/java/org/apache/datasketches/sampling/EbppsItemsSketch.java
index 0b1552be..e1fd8da1 100644
--- a/src/main/java/org/apache/datasketches/sampling/EbppsItemsSketch.java
+++ b/src/main/java/org/apache/datasketches/sampling/EbppsItemsSketch.java
@@ -19,6 +19,7 @@
package org.apache.datasketches.sampling;
+import static org.apache.datasketches.common.Util.LS;
import static org.apache.datasketches.sampling.PreambleUtil.EBPPS_SER_VER;
import static org.apache.datasketches.sampling.PreambleUtil.EMPTY_FLAG_MASK;
import static org.apache.datasketches.sampling.PreambleUtil.HAS_PARTIAL_ITEM_MASK;
@@ -365,7 +366,20 @@ public class EbppsItemsSketch<T> {
*/
@Override
public String toString() {
- return null;
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append(LS);
+ final String thisSimpleName = this.getClass().getSimpleName();
+ sb.append("### ").append(thisSimpleName).append(" SUMMARY: ").append(LS);
+ sb.append(" k : ").append(k_).append(LS);
+ sb.append(" n : ").append(n_).append(LS);
+ sb.append(" Cum. weight : ").append(cumulativeWt_).append(LS);
+ sb.append(" wtMax : ").append(wtMax_).append(LS);
+ sb.append(" rho : ").append(rho_).append(LS);
+ sb.append(" C : ").append(sample_.getC()).append(LS);
+ sb.append("### END SKETCH SUMMARY").append(LS);
+
+ return sb.toString();
}
/**
diff --git a/src/test/java/org/apache/datasketches/sampling/EbppsSampleTest.java b/src/test/java/org/apache/datasketches/sampling/EbppsItemsSampleTest.java
similarity index 100%
rename from src/test/java/org/apache/datasketches/sampling/EbppsSampleTest.java
rename to src/test/java/org/apache/datasketches/sampling/EbppsItemsSampleTest.java
diff --git a/src/test/java/org/apache/datasketches/sampling/EbppsSketchTest.java b/src/test/java/org/apache/datasketches/sampling/EbppsItemsSketchTest.java
similarity index 99%
rename from src/test/java/org/apache/datasketches/sampling/EbppsSketchTest.java
rename to src/test/java/org/apache/datasketches/sampling/EbppsItemsSketchTest.java
index 8980b84f..e967aff4 100644
--- a/src/test/java/org/apache/datasketches/sampling/EbppsSketchTest.java
+++ b/src/test/java/org/apache/datasketches/sampling/EbppsItemsSketchTest.java
@@ -21,6 +21,7 @@ package org.apache.datasketches.sampling;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.util.ArrayList;
@@ -210,6 +211,8 @@ public class EbppsSketchTest {
mem = Memory.wrap(bytes);
sk_heapify = EbppsItemsSketch.heapify(mem, new ArrayOfStringsSerDe());
checkIfEqual(sk, sk_heapify);
+
+ assertNotNull(sk.toString());
}
@Test(expectedExceptions = SketchesArgumentException.class)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org