You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@datasketches.apache.org by "leerho (via GitHub)" <gi...@apache.org> on 2025/08/16 00:33:47 UTC

[PR] Cleanup phase2 (datasketches-java)

leerho opened a new pull request, #684:
URL: https://github.com/apache/datasketches-java/pull/684

   (no comment)


-- 
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-unsubscribe@datasketches.apache.org

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


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


Re: [PR] Cleanup phase2 (datasketches-java)

Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #684:
URL: https://github.com/apache/datasketches-java/pull/684#discussion_r2288813612


##########
src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java:
##########
@@ -151,29 +151,59 @@ public static DoublesSketch heapify(final MemorySegment srcSeg) {
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of a compact, read-only DoublesSketch.
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @param srcSeg the given MemorySegment image of a compact, read-only DoublesSketch.
+   * @return a compact, read-only sketch that wraps the given MemorySegment.
    */
   public static DoublesSketch wrap(final MemorySegment srcSeg) {
+    if (!checkIsMemorySegmentCompact(srcSeg)) {
+      throw new SketchesArgumentException("MemorySegment sketch image must be in compact form.");

Review Comment:
   The larger context here is that moving from datasketches-java 8.0.0 to datasketches-java 9.0.0 is a major rewrite of the entire library and there will be some unavoidable breaking changes as a result.  This is one of them.  The library's dependency on datasketches-memory has been entirely removed and that code has been migrated to the new Java FMM in Java 25.  Such a major change was not practical to do without a few breaking changes.
   
   However, what is actually going on here is the previous wrap(...) method that accepted both compact and updatable MemorySegments has been split into two methods: a wrap(...) for compact segments and a writableWrap(...) for updatable segments, which is actually much clearer than the previous wrap(...) method, which was ambiguous.  Also, splitting this into two wrap(...) and writableWrap(...) methods matches the same API protocol used in other sketches in the library. 
   
   



-- 
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-unsubscribe@datasketches.apache.org

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


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


Re: [PR] Cleanup phase2 (datasketches-java)

Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #684:
URL: https://github.com/apache/datasketches-java/pull/684#discussion_r2285757050


##########
.github/workflows/auto-jdk-matrix.yml:
##########
@@ -20,7 +20,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        jdk: [ 21 ]
+        jdk: [ 24 ]

Review Comment:
   Thanks, but the problem I have had with -ea releases is that not all tools support them.  Eclipse, for example, is really flaky with -ea releases and I've had trouble with GitHub Actions runners that don't recognize -ea releases.  It is only a few more weeks until Java 25 is formally released :)



-- 
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-unsubscribe@datasketches.apache.org

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


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


Re: [PR] Cleanup phase2 (datasketches-java)

Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #684:
URL: https://github.com/apache/datasketches-java/pull/684#discussion_r2288829540


##########
src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java:
##########
@@ -151,29 +151,59 @@ public static DoublesSketch heapify(final MemorySegment srcSeg) {
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of a compact, read-only DoublesSketch.
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @param srcSeg the given MemorySegment image of a compact, read-only DoublesSketch.
+   * @return a compact, read-only sketch that wraps the given MemorySegment.
    */
   public static DoublesSketch wrap(final MemorySegment srcSeg) {
+    if (!checkIsMemorySegmentCompact(srcSeg)) {
+      throw new SketchesArgumentException("MemorySegment sketch image must be in compact form.");
+    }
+    return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+  }
+
+  /**
+   * Wrap this sketch around the given MemorySegment image of an updatable DoublesSketch.
+   *
+   * <p>The given MemorySegment must be writable and it must contain a <i>UpdateDoublesSketch</i>.
+   * The sketch will be updated and managed totally within the MemorySegment. If the given source
+   * MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.</p>
+   *
+   * <p><b>NOTE:</b>If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch
+   * will request more capacity using the {@link MemorySegmentRequest MemorySegmentRequest} interface. The default of this interface will
+   * return a new MemorySegment on the heap.</p>
+   *
+   * @param srcSeg the given MemorySegment image of an <i>UpdateDoublesSketch</i>.
+   * @return an updatable sketch that wraps the given MemorySegment.
+   */
+  public static DoublesSketch writableWrap(final MemorySegment srcSeg) {
     if (checkIsMemorySegmentCompact(srcSeg)) {
-      return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+      throw new SketchesArgumentException("MemorySegment sketch image must be in updatable form.");

Review Comment:
   Done.



-- 
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-unsubscribe@datasketches.apache.org

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


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


Re: [PR] Cleanup phase2 (datasketches-java)

Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho merged PR #684:
URL: https://github.com/apache/datasketches-java/pull/684


-- 
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-unsubscribe@datasketches.apache.org

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


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


Re: [PR] Cleanup phase2 (datasketches-java)

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #684:
URL: https://github.com/apache/datasketches-java/pull/684#discussion_r2286796244


##########
.github/workflows/javadoc.yml:
##########
@@ -30,7 +33,7 @@ jobs:
         run: mvn javadoc:javadoc
 
       - name: Deploy JavaDoc
-        uses: JamesIves/github-pages-deploy-action@v4.6.8
+        uses: JamesIves/github-pages-deploy-action@881db5376404c5c8d621010bcbec0310b58d5e29

Review Comment:
   Using a full commit SHA instead of a version tag for GitHub Action reduces transparency and makes it harder to verify the action version. Consider using a tagged version like @v4.6.8 or newer.
   ```suggestion
           uses: JamesIves/github-pages-deploy-action@v4.6.8
   ```



##########
src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java:
##########
@@ -151,29 +151,59 @@ public static DoublesSketch heapify(final MemorySegment srcSeg) {
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of a compact, read-only DoublesSketch.
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @param srcSeg the given MemorySegment image of a compact, read-only DoublesSketch.
+   * @return a compact, read-only sketch that wraps the given MemorySegment.
    */
   public static DoublesSketch wrap(final MemorySegment srcSeg) {
+    if (!checkIsMemorySegmentCompact(srcSeg)) {
+      throw new SketchesArgumentException("MemorySegment sketch image must be in compact form.");

Review Comment:
   The wrap() method now throws an exception for non-compact segments, which is a breaking API change. Consider providing a deprecation period or clearer migration path for existing code that may pass updatable segments to this method.



##########
src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java:
##########
@@ -151,29 +151,59 @@ public static DoublesSketch heapify(final MemorySegment srcSeg) {
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of a compact, read-only DoublesSketch.
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @param srcSeg the given MemorySegment image of a compact, read-only DoublesSketch.
+   * @return a compact, read-only sketch that wraps the given MemorySegment.
    */
   public static DoublesSketch wrap(final MemorySegment srcSeg) {
+    if (!checkIsMemorySegmentCompact(srcSeg)) {
+      throw new SketchesArgumentException("MemorySegment sketch image must be in compact form.");

Review Comment:
   The error message could be more helpful by suggesting the alternative method to use: "MemorySegment sketch image must be in compact form. Use writableWrap() for updatable sketches."
   ```suggestion
         throw new SketchesArgumentException("MemorySegment sketch image must be in compact form. Use writableWrap() for updatable sketches.");
   ```



##########
src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java:
##########
@@ -151,29 +151,59 @@ public static DoublesSketch heapify(final MemorySegment srcSeg) {
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of a compact, read-only DoublesSketch.
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @param srcSeg the given MemorySegment image of a compact, read-only DoublesSketch.
+   * @return a compact, read-only sketch that wraps the given MemorySegment.
    */
   public static DoublesSketch wrap(final MemorySegment srcSeg) {
+    if (!checkIsMemorySegmentCompact(srcSeg)) {
+      throw new SketchesArgumentException("MemorySegment sketch image must be in compact form.");
+    }
+    return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+  }
+
+  /**
+   * Wrap this sketch around the given MemorySegment image of an updatable DoublesSketch.
+   *
+   * <p>The given MemorySegment must be writable and it must contain a <i>UpdateDoublesSketch</i>.
+   * The sketch will be updated and managed totally within the MemorySegment. If the given source
+   * MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.</p>
+   *
+   * <p><b>NOTE:</b>If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch
+   * will request more capacity using the {@link MemorySegmentRequest MemorySegmentRequest} interface. The default of this interface will
+   * return a new MemorySegment on the heap.</p>
+   *
+   * @param srcSeg the given MemorySegment image of an <i>UpdateDoublesSketch</i>.
+   * @return an updatable sketch that wraps the given MemorySegment.
+   */
+  public static DoublesSketch writableWrap(final MemorySegment srcSeg) {
     if (checkIsMemorySegmentCompact(srcSeg)) {
-      return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+      throw new SketchesArgumentException("MemorySegment sketch image must be in updatable form.");
     }
     return DirectUpdateDoublesSketch.wrapInstance(srcSeg, null);
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of an updatable DoublesSketch.
+   *
+   * <p>The given MemorySegment must be writable and it must contain a <i>UpdateDoublesSketch</i>.
+   * The sketch will be updated and managed totally within the MemorySegment. If the given source
+   * MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.</p>
+   *
+   * <p><b>NOTE:</b>If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch
+   * will request more capacity using the {@link MemorySegmentRequest MemorySegmentRequest} interface. The default of this interface will
+   * return a new MemorySegment on the heap. It is up to the user to optionally extend this interface if more flexible
+   * handling of requests for more capacity is required.</p>
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data.
+   * @param srcSeg the given MemorySegment image of a DoublesSketch.
    * @param mSegReq the MemorySegmentRequest used if the given MemorySegment needs to expand.
    * Otherwise, it can be null and the default MemorySegmentRequest will be used.
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @return a sketch that wraps the given MemorySegment.
    */
-  public static DoublesSketch wrap(final MemorySegment srcSeg, final MemorySegmentRequest mSegReq) {
+  public static DoublesSketch writableWrap(final MemorySegment srcSeg, final MemorySegmentRequest mSegReq) {
     if (checkIsMemorySegmentCompact(srcSeg)) {
-      return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+      throw new SketchesArgumentException("MemorySegment sketch image must be in updatable form.");

Review Comment:
   The error message could be more helpful by suggesting the alternative method to use: "MemorySegment sketch image must be in updatable form. Use wrap() for compact sketches."
   ```suggestion
         throw new SketchesArgumentException("MemorySegment sketch image must be in updatable form. Use wrap() for compact sketches.");
   ```



##########
src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java:
##########
@@ -151,29 +151,59 @@ public static DoublesSketch heapify(final MemorySegment srcSeg) {
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of a compact, read-only DoublesSketch.
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @param srcSeg the given MemorySegment image of a compact, read-only DoublesSketch.
+   * @return a compact, read-only sketch that wraps the given MemorySegment.
    */
   public static DoublesSketch wrap(final MemorySegment srcSeg) {
+    if (!checkIsMemorySegmentCompact(srcSeg)) {
+      throw new SketchesArgumentException("MemorySegment sketch image must be in compact form.");
+    }
+    return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+  }
+
+  /**
+   * Wrap this sketch around the given MemorySegment image of an updatable DoublesSketch.
+   *
+   * <p>The given MemorySegment must be writable and it must contain a <i>UpdateDoublesSketch</i>.
+   * The sketch will be updated and managed totally within the MemorySegment. If the given source
+   * MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.</p>
+   *
+   * <p><b>NOTE:</b>If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch
+   * will request more capacity using the {@link MemorySegmentRequest MemorySegmentRequest} interface. The default of this interface will
+   * return a new MemorySegment on the heap.</p>
+   *
+   * @param srcSeg the given MemorySegment image of an <i>UpdateDoublesSketch</i>.
+   * @return an updatable sketch that wraps the given MemorySegment.
+   */
+  public static DoublesSketch writableWrap(final MemorySegment srcSeg) {
     if (checkIsMemorySegmentCompact(srcSeg)) {
-      return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+      throw new SketchesArgumentException("MemorySegment sketch image must be in updatable form.");

Review Comment:
   The error message could be more helpful by suggesting the alternative method to use: "MemorySegment sketch image must be in updatable form. Use wrap() for compact sketches."
   ```suggestion
         throw new SketchesArgumentException("MemorySegment sketch image must be in updatable form. Use wrap() for compact sketches.");
   ```



-- 
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-unsubscribe@datasketches.apache.org

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


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


Re: [PR] Cleanup phase2 (datasketches-java)

Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #684:
URL: https://github.com/apache/datasketches-java/pull/684#discussion_r2288775049


##########
.github/workflows/javadoc.yml:
##########
@@ -30,7 +33,7 @@ jobs:
         run: mvn javadoc:javadoc
 
       - name: Deploy JavaDoc
-        uses: JamesIves/github-pages-deploy-action@v4.6.8
+        uses: JamesIves/github-pages-deploy-action@881db5376404c5c8d621010bcbec0310b58d5e29

Review Comment:
   This is not an option.  GitHub has only 2 approved versions of this action and they are specified by the SHA tag.



-- 
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-unsubscribe@datasketches.apache.org

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


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


Re: [PR] Cleanup phase2 (datasketches-java)

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #684:
URL: https://github.com/apache/datasketches-java/pull/684#discussion_r2284643900


##########
.github/workflows/auto-jdk-matrix.yml:
##########
@@ -20,7 +20,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        jdk: [ 21 ]
+        jdk: [ 24 ]

Review Comment:
   Java 25 reaches RC phase, `25-ea` is available for testing.



-- 
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-unsubscribe@datasketches.apache.org

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


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


Re: [PR] Cleanup phase2 (datasketches-java)

Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #684:
URL: https://github.com/apache/datasketches-java/pull/684#discussion_r2288824798


##########
src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java:
##########
@@ -151,29 +151,59 @@ public static DoublesSketch heapify(final MemorySegment srcSeg) {
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of a compact, read-only DoublesSketch.
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @param srcSeg the given MemorySegment image of a compact, read-only DoublesSketch.
+   * @return a compact, read-only sketch that wraps the given MemorySegment.
    */
   public static DoublesSketch wrap(final MemorySegment srcSeg) {
+    if (!checkIsMemorySegmentCompact(srcSeg)) {
+      throw new SketchesArgumentException("MemorySegment sketch image must be in compact form.");

Review Comment:
   Done.



##########
src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java:
##########
@@ -151,29 +151,59 @@ public static DoublesSketch heapify(final MemorySegment srcSeg) {
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of a compact, read-only DoublesSketch.
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @param srcSeg the given MemorySegment image of a compact, read-only DoublesSketch.
+   * @return a compact, read-only sketch that wraps the given MemorySegment.
    */
   public static DoublesSketch wrap(final MemorySegment srcSeg) {
+    if (!checkIsMemorySegmentCompact(srcSeg)) {
+      throw new SketchesArgumentException("MemorySegment sketch image must be in compact form.");
+    }
+    return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+  }
+
+  /**
+   * Wrap this sketch around the given MemorySegment image of an updatable DoublesSketch.
+   *
+   * <p>The given MemorySegment must be writable and it must contain a <i>UpdateDoublesSketch</i>.
+   * The sketch will be updated and managed totally within the MemorySegment. If the given source
+   * MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.</p>
+   *
+   * <p><b>NOTE:</b>If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch
+   * will request more capacity using the {@link MemorySegmentRequest MemorySegmentRequest} interface. The default of this interface will
+   * return a new MemorySegment on the heap.</p>
+   *
+   * @param srcSeg the given MemorySegment image of an <i>UpdateDoublesSketch</i>.
+   * @return an updatable sketch that wraps the given MemorySegment.
+   */
+  public static DoublesSketch writableWrap(final MemorySegment srcSeg) {
     if (checkIsMemorySegmentCompact(srcSeg)) {
-      return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+      throw new SketchesArgumentException("MemorySegment sketch image must be in updatable form.");
     }
     return DirectUpdateDoublesSketch.wrapInstance(srcSeg, null);
   }
 
   /**
-   * Wrap this sketch around the given updatable MemorySegment image of a DoublesSketch, compact or updatable.
+   * Wrap this sketch around the given MemorySegment image of an updatable DoublesSketch.
+   *
+   * <p>The given MemorySegment must be writable and it must contain a <i>UpdateDoublesSketch</i>.
+   * The sketch will be updated and managed totally within the MemorySegment. If the given source
+   * MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.</p>
+   *
+   * <p><b>NOTE:</b>If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch
+   * will request more capacity using the {@link MemorySegmentRequest MemorySegmentRequest} interface. The default of this interface will
+   * return a new MemorySegment on the heap. It is up to the user to optionally extend this interface if more flexible
+   * handling of requests for more capacity is required.</p>
    *
-   * @param srcSeg the given MemorySegment image of a DoublesSketch that may have data.
+   * @param srcSeg the given MemorySegment image of a DoublesSketch.
    * @param mSegReq the MemorySegmentRequest used if the given MemorySegment needs to expand.
    * Otherwise, it can be null and the default MemorySegmentRequest will be used.
-   * @return a sketch that wraps the given srcSeg in read-only mode.
+   * @return a sketch that wraps the given MemorySegment.
    */
-  public static DoublesSketch wrap(final MemorySegment srcSeg, final MemorySegmentRequest mSegReq) {
+  public static DoublesSketch writableWrap(final MemorySegment srcSeg, final MemorySegmentRequest mSegReq) {
     if (checkIsMemorySegmentCompact(srcSeg)) {
-      return DirectCompactDoublesSketch.wrapInstance(srcSeg);
+      throw new SketchesArgumentException("MemorySegment sketch image must be in updatable form.");

Review Comment:
   Done.



-- 
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-unsubscribe@datasketches.apache.org

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


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