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


##########
src/test/java/org/apache/datasketches/quantiles/ReadOnlyMemoryTest.java:
##########
@@ -184,92 +185,92 @@ public void wrapEmptyUpdateSketch() {
   @Test
   public void wrapEmptyCompactSketch() {
     final UpdateDoublesSketch s1 = DoublesSketch.builder().build();
-    final Memory mem = Memory.wrap(s1.compact().toByteArray());
-    DoublesSketch s2 = DoublesSketch.wrap(mem); // compact, so this is ok
+    final MemorySegment seg = 
MemorySegment.ofArray(s1.compact().toByteArray());
+    final DoublesSketch s2 = DoublesSketch.wrap(seg); // compact, so this is ok
     Assert.assertTrue(s2.isEmpty());
   }
 
   @Test
   public void heapifyUnionFromSparse() {
-    UpdateDoublesSketch s1 = DoublesSketch.builder().build();
+    final UpdateDoublesSketch s1 = DoublesSketch.builder().build();
     s1.update(1);
     s1.update(2);
-    Memory mem = Memory.wrap(s1.toByteArray(false));
-    DoublesUnion u = DoublesUnion.heapify(mem);
+    final MemorySegment seg = MemorySegment.ofArray(s1.toByteArray(false));
+    final DoublesUnion u = DoublesUnion.heapify(seg);
     u.update(3);
-    DoublesSketch s2 = u.getResult();
+    final DoublesSketch s2 = u.getResult();
     Assert.assertEquals(s2.getMinItem(), 1.0);
     Assert.assertEquals(s2.getMaxItem(), 3.0);
   }
 
   @Test
   public void heapifyUnionFromCompact() {
-    UpdateDoublesSketch s1 = DoublesSketch.builder().build();
+    final UpdateDoublesSketch s1 = DoublesSketch.builder().build();
     s1.update(1);
     s1.update(2);
-    Memory mem = Memory.wrap(s1.toByteArray(true));
-    DoublesUnion u = DoublesUnion.heapify(mem);
+    final MemorySegment seg = MemorySegment.ofArray(s1.toByteArray(true));
+    final DoublesUnion u = DoublesUnion.heapify(seg);
     u.update(3);
-    DoublesSketch s2 = u.getResult();
+    final DoublesSketch s2 = u.getResult();
     Assert.assertEquals(s2.getMinItem(), 1.0);
     Assert.assertEquals(s2.getMaxItem(), 3.0);
   }
 
   @Test
   public void wrapUnionFromSparse() {
-    UpdateDoublesSketch s1 = DoublesSketch.builder().build();
+    final UpdateDoublesSketch s1 = DoublesSketch.builder().build();
     s1.update(1);
     s1.update(2);
-    Memory mem = Memory.wrap(s1.toByteArray(false));
-    DoublesUnion u = DoublesUnion.wrap(mem);
-    DoublesSketch s2 = u.getResult();
+    final MemorySegment seg = 
MemorySegment.ofArray(s1.toByteArray(false)).asReadOnly();
+    final DoublesUnion u = DoublesUnion.wrap(seg);

Review Comment:
   Not sure I follow.  It IS being made read-only in line 224. And that is the 
exact change that is being proposed in this PR. No change is necessary.



-- 
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: dev-unsubscr...@datasketches.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@datasketches.apache.org
For additional commands, e-mail: dev-h...@datasketches.apache.org

Reply via email to