github-code-scanning[bot] commented on code in PR #422:
URL: https://github.com/apache/datasketches-java/pull/422#discussion_r1044930202
##########
src/test/java/org/apache/datasketches/hll/UnionTest.java:
##########
@@ -467,7 +467,7 @@
WritableMemory wmem = WritableMemory.allocate(bytes);
new Union(lgK, wmem); // result is unused, relying on side effect
int trueCount = 0;
- int delta = (lgK < 8) ? 16 : 1 << (lgK - 3);
+ int delta = (lgK < 8) ? 16 : 1 << (lgK - 3); //allows to vary lgK above
Review Comment:
## Useless comparison test
Test is always false.
[Show more
details](https://github.com/apache/datasketches-java/security/code-scanning/479)
##########
src/main/java/org/apache/datasketches/cpc/CpcUnion.java:
##########
@@ -298,7 +298,7 @@
final int state = ((sourceFlavorOrd - 1) << 1) | ((union.bitMatrix !=
null) ? 1 : 0);
switch (state) {
case 0 : { //A: Sparse, bitMatrix == null, accumulator valid
- if ((union.accumulator.getFlavor() == EMPTY) //lgtm
[java/dereferenced-value-may-be-null]
+ if ((union.accumulator.getFlavor() == EMPTY)
Review Comment:
## Dereferenced variable may be null
Variable [accumulator](1) may be null at this access because of [this](2)
assignment.
[Show more
details](https://github.com/apache/datasketches-java/security/code-scanning/480)
##########
src/test/java/org/apache/datasketches/hll/UnionTest.java:
##########
@@ -437,7 +437,7 @@
public void checkUnionHeapifyRebuildAfterMerge() {
int lgK = 12;
//Build 2 sketches in HLL (dense) mode.
- int u = (lgK < 8) ? 16 : 1 << (lgK - 3);
+ int u = (lgK < 8) ? 16 : 1 << (lgK - 3); //allows changing lgK above
Review Comment:
## Useless comparison test
Test is always false.
[Show more
details](https://github.com/apache/datasketches-java/security/code-scanning/478)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]