leerho commented on code in PR #685:
URL: https://github.com/apache/datasketches-java/pull/685#discussion_r2408964844


##########
src/main/java/org/apache/datasketches/theta/CompactSketch.java:
##########
@@ -87,119 +81,85 @@ public static CompactSketch heapify(final MemorySegment 
srcSeg) {
    * <p>The resulting sketch will not retain any link to the source 
MemorySegment and all of its data will be
    * copied to the heap CompactSketch.</p>
    *
-   * <p>This method checks if the given expectedSeed was used to create the 
source MemorySegment image.
-   * However, SerialVersion 1 sketch images cannot be checked as they don't 
have a seedHash field,
-   * so the resulting heapified CompactSketch will be given the hash of the 
expectedSeed.</p>
+   * <p>This method checks if the given expectedSeed was used to create the 
source MemorySegment image.</p>
    *
    * @param srcSeg an image of a CompactSketch that was created using the 
given expectedSeed.
    * @param expectedSeed the seed used to validate the given MemorySegment 
image.
    * <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash 
Seed</a>.
    * @return a CompactSketch on the heap.
    */
   public static CompactSketch heapify(final MemorySegment srcSeg, final long 
expectedSeed) {
-    return heapify(srcSeg, expectedSeed, true);
-  }
-
-  private static CompactSketch heapify(final MemorySegment srcSeg, final long 
seed, final boolean enforceSeed) {
     final int serVer = extractSerVer(srcSeg);
     final int familyID = extractFamilyID(srcSeg);
     final Family family = idToFamily(familyID);
     if (family != Family.COMPACT) {
       throw new SketchesArgumentException("Corrupted: " + family + " is not 
Compact!");
     }
     if (serVer == 4) {
-       return heapifyV4(srcSeg, seed, enforceSeed);
+       return heapifyV4(srcSeg, expectedSeed);
     }
     if (serVer == 3) {
       final int flags = extractFlags(srcSeg);
       final boolean srcOrdered = (flags & ORDERED_FLAG_MASK) != 0;
       final boolean empty = (flags & EMPTY_FLAG_MASK) != 0;
-      if (enforceSeed && !empty) { PreambleUtil.checkSegmentSeedHash(srcSeg, 
seed); }
+      if (!empty) { PreambleUtil.checkSegmentSeedHash(srcSeg, expectedSeed); }
       return CompactOperations.segmentToCompact(srcSeg, srcOrdered, null);
     }
-    //not SerVer 3, assume compact stored form
-    final short seedHash = Util.computeSeedHash(seed);
-    if (serVer == 1) {

Review Comment:
   Please see my message on dev@: 
https://lists.apache.org/thread/4c78gsls7xjrn0b4cosvppywh2clwz6x
   To Wit:
   
   > Our backward compatibility promise is primarily focused on the binary
   > compatibility of being able to read serializations of earlier versions of
   > the code with our latest versions. This is still true. However, up until
   > recently we have been supporting binary compatibility with very early code
   > versions at Yahoo that existed long before our code was first open-sourced
   > in August of 2015 (we became part of ASF in 2020). Since Yahoo is in the
   > process of obsoleting those systems that used some of that code there is no
   > reason that we need to keep supporting it.
   
   The older versions being referred to are specifically SerVer 1 and 2 of the 
Theta Sketch.



-- 
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]

Reply via email to