You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by ti...@apache.org on 2026/02/05 13:44:38 UTC
(datasketches-java) branch main updated: chore: tidy comment and code of CpcSketch (#722)
This is an automated email from the ASF dual-hosted git repository.
tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git
The following commit(s) were added to refs/heads/main by this push:
new cf427ae71 chore: tidy comment and code of CpcSketch (#722)
cf427ae71 is described below
commit cf427ae713379f677dadc966efb18fbf3edd9a2d
Author: tison <wa...@gmail.com>
AuthorDate: Thu Feb 5 21:44:33 2026 +0800
chore: tidy comment and code of CpcSketch (#722)
Signed-off-by: tison <wa...@gmail.com>
---
src/main/java/org/apache/datasketches/cpc/CpcSketch.java | 2 +-
src/main/java/org/apache/datasketches/cpc/CpcUnion.java | 2 +-
src/main/java/org/apache/datasketches/cpc/PreambleUtil.java | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/datasketches/cpc/CpcSketch.java b/src/main/java/org/apache/datasketches/cpc/CpcSketch.java
index 212670c50..d5e17388a 100644
--- a/src/main/java/org/apache/datasketches/cpc/CpcSketch.java
+++ b/src/main/java/org/apache/datasketches/cpc/CpcSketch.java
@@ -621,7 +621,7 @@ public final class CpcSketch {
assert ((sketch.windowOffset >= 0) && (sketch.windowOffset <= 56));
final int k = 1 << sketch.lgK;
final long c32pre = sketch.numCoupons << 5;
- assert c32pre >= (3L * k); // C < 3K/32, in other words flavor >= HYBRID
+ assert c32pre >= (3L * k); // C >= 3K/32, in other words flavor >= HYBRID
final long c8pre = sketch.numCoupons << 3;
final int w8pre = sketch.windowOffset << 3;
assert c8pre < ((27L + w8pre) * k); // C < (K * 27/8) + (K * windowOffset)
diff --git a/src/main/java/org/apache/datasketches/cpc/CpcUnion.java b/src/main/java/org/apache/datasketches/cpc/CpcUnion.java
index 8aeb48bbf..34ded3a9c 100644
--- a/src/main/java/org/apache/datasketches/cpc/CpcUnion.java
+++ b/src/main/java/org/apache/datasketches/cpc/CpcUnion.java
@@ -124,7 +124,7 @@ public class CpcUnion {
bitMatrix = null;
// We begin with the accumulator holding an EMPTY_MERGED sketch object.
// As an optimization the accumulator could start as NULL, but that would require changes elsewhere.
- accumulator = new CpcSketch(lgK);
+ accumulator = new CpcSketch(lgK, seed);
}
/**
diff --git a/src/main/java/org/apache/datasketches/cpc/PreambleUtil.java b/src/main/java/org/apache/datasketches/cpc/PreambleUtil.java
index 80960f69a..f24c86dd1 100644
--- a/src/main/java/org/apache/datasketches/cpc/PreambleUtil.java
+++ b/src/main/java/org/apache/datasketches/cpc/PreambleUtil.java
@@ -152,7 +152,7 @@ final class PreambleUtil {
static final int RESERVED_FLAG_MASK = 1; //Reserved.
static final int COMPRESSED_FLAG_MASK = 2;
static final int HIP_FLAG_MASK = 4;
- static final int SUP_VAL_FLAG_MASK = 8; //num Suprising Values > 0
+ static final int SUP_VAL_FLAG_MASK = 8; //num Surprising Values > 0
static final int WINDOW_FLAG_MASK = 16;//window length > 0
//PREAMBLE SIZE
@@ -253,7 +253,7 @@ final class PreambleUtil {
* Do not change the order.
*
* <p>Note: NUM_SV has dual meanings: In sparse and hybrid flavors it is equivalent to
- * numCoupons so it isn't stored separately. In pinned and sliding flavors is is the
+ * numCoupons so it isn't stored separately. In pinned and sliding flavors is the
* numSV of the PairTable, which stores only surprising values.</p>
*/
enum HiField { NUM_COUPONS, NUM_SV, KXP, HIP_ACCUM, SV_LENGTH_INTS, W_LENGTH_INTS, SV_STREAM,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org