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


##########
src/main/java/org/apache/datasketches/tuple/CompactTupleSketch.java:
##########
@@ -78,8 +82,60 @@
     super(thetaLong, empty, null, seedHash);
     super.thetaLong_ = thetaLong;
     super.empty_ = empty;
-    hashArr_ = hashArr;
-    summaryArr_ = summaryArr;
+    if ((hashArr == null) || isSorted(hashArr)) {
+      hashArr_ = hashArr;
+      summaryArr_ = summaryArr;
+    } else {
+      hashArr_ = hashArr.clone();
+      summaryArr_ = summaryArr.clone();

Review Comment:
   False positive: every caller passes both arrays or neither. e8ca89269 adds 
an explicit `summaryArr == null` check to make that clear.



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