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


##########
src/main/java/org/apache/datasketches/tuple/QuickSelectSketch.java:
##########
@@ -415,10 +440,16 @@ public CompactTupleSketch<S> compact() {
    * @deprecated As of 3.0.0, serializing an UpdatableTupleSketch is 
deprecated.
    * This capability will be removed in a future release.
    * Serializing a CompactTupleSketch is not deprecated.
+   * @throws SketchesStateException if this sketch was created with a custom 
seed,
+   * because this serialized form has no seed hash. Use 
compact().toByteArray() instead.
    */
   @Deprecated
   @Override
   public byte[] toByteArray() {
+    if (seedHash_ != Util.DEFAULT_SEED_HASH) {

Review Comment:
   Good catch: the seed hash was the wrong thing to compare here. 
`QuickSelectSketch` only has the seed hash, so the check now lives in 
`UpdatableTupleSketch.toByteArray()`, which has the user's seed and compares it 
with `DEFAULT_UPDATE_SEED` (f2622cd57). This also refuses a custom seed whose 
16-bit seed hash happens to equal the default seed hash, which the old check 
would have let through. `QuickSelectSketch.toByteArray()` no longer checks 
anything: its other instances are heapified from the updatable form, which 
always uses the default seed, or are the internal sketch of `TupleUnion`, which 
is never serialized.



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