davecromberge commented on a change in pull request #324:
URL:
https://github.com/apache/incubator-datasketches-java/pull/324#discussion_r455383769
##########
File path: src/main/java/org/apache/datasketches/theta/HeapAlphaSketch.java
##########
@@ -128,20 +128,19 @@ static HeapAlphaSketch heapifyInstance(final Memory
srcMem, final long seed) {
checkMemIntegrity(srcMem, seed, preambleLongs, lgNomLongs, lgArrLongs);
final float p = extractP(srcMem); //bytes 12-15
- final int lgRF = extractLgResizeFactor(srcMem); //byte 0
- final ResizeFactor myRF = ResizeFactor.getRF(lgRF);
+ final int memlgRF = extractLgResizeFactor(srcMem); //byte 0
+ final ResizeFactor memRF = ResizeFactor.getRF(memlgRF);
final double nomLongs = (1L << lgNomLongs);
final double alpha = nomLongs / (nomLongs + 1.0);
final long split1 = (long) (((p * (alpha + 1.0)) / 2.0) *
LONG_MAX_VALUE_AS_DOUBLE);
- if ((myRF == ResizeFactor.X1)
- && (lgArrLongs != startingSubMultiple(lgNomLongs + 1, myRF,
MIN_LG_ARR_LONGS))) {
- throw new SketchesArgumentException("Possible corruption: ResizeFactor
X1, but provided "
- + "array too small for sketch size");
+ if (isResizeFactorIncorrect(srcMem, lgNomLongs, lgArrLongs)) {
+ throw new SketchesArgumentException("Possible corruption: ResizeFactor "
+ + "inconsistent with lgNomLongs and lgArrLongs.");
Review comment:
This is a different approach taken than that of the
DirectQuickSelect/HeapQuickSelect sketches, where X2 is selected as a resize
factor when the arguments are incorrect, as per the comment:
```//If incorrect it sets it to X2 which always works.```
Is this by design?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]