Commit fe85bf2
[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 <yangjie01@baidu.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
(cherry picked from commit 1409d88)
Signed-off-by: Max Gekk <max.gekk@gmail.com>1 parent 12983be commit fe85bf2
1 file changed
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments