This is an automated email from the ASF dual-hosted git repository.
MaxGekk pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.x by this push:
new fe85bf284e7e [MINOR][CORE] Fix swapped depth/width formulas in
CountMinSketch class doc
fe85bf284e7e is described below
commit fe85bf284e7eeb4d92101b00ee3793c3eed9c29b
Author: YangJie <[email protected]>
AuthorDate: Tue Jun 30 13:39:43 2026 +0200
[MINOR][CORE] Fix swapped depth/width formulas in CountMinSketch class doc
### What changes were proposed in this pull request?
This PR fixes the class-level Javadoc of
`org.apache.spark.util.sketch.CountMinSketch`, which assigned the two table
dimensions to the wrong symbols. The doc previously read:
```
d = ceil(2 / eps)
w = ceil(-log(1 - confidence) / log(2))
```
but the implementation (`CountMinSketchImpl`, the `(eps, confidence, seed)`
constructor) actually sets:
```java
this.width = (int) Math.ceil(2 / eps);
this.depth = (int) Math.ceil(-Math.log1p(-confidence) / Math.log(2));
```
i.e. `width` is derived from `eps` and `depth` from `confidence` -- the
opposite of what the doc stated. The fix swaps the two lines so the doc matches
the code:
```
w = ceil(2 / eps)
d = ceil(-log(1 - confidence) / log(2))
```
### Why are the changes needed?
Doc fix
### Does this PR introduce _any_ user-facing change?
No. Documentation-only change; no behavior, serialization, or API impact.
### How was this patch tested?
Pass Github Actions
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code
Closes #56897 from LuciferYang/minor-countminsketch-doc-fix.
Authored-by: YangJie <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
(cherry picked from commit 1409d88cfaab416b5bf61b875408418761004bb5)
Signed-off-by: Max Gekk <[email protected]>
---
.../src/main/java/org/apache/spark/util/sketch/CountMinSketch.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/common/sketch/src/main/java/org/apache/spark/util/sketch/CountMinSketch.java
b/common/sketch/src/main/java/org/apache/spark/util/sketch/CountMinSketch.java
index 06a248c9a27c..cc958f947b4d 100644
---
a/common/sketch/src/main/java/org/apache/spark/util/sketch/CountMinSketch.java
+++
b/common/sketch/src/main/java/org/apache/spark/util/sketch/CountMinSketch.java
@@ -45,8 +45,8 @@ import java.io.OutputStream;
* Under the cover, a {@link CountMinSketch} is essentially a two-dimensional
{@code long} array
* with depth {@code d} and width {@code w}, where
* <ul>
- * <li>{@code d = ceil(2 / eps)}</li>
- * <li>{@code w = ceil(-log(1 - confidence) / log(2))}</li>
+ * <li>{@code w = ceil(2 / eps)}</li>
+ * <li>{@code d = ceil(-log(1 - confidence) / log(2))}</li>
* </ul>
*
* This implementation is largely based on the {@code CountMinSketch} class
from stream-lib.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]