loquisgon commented on a change in pull request #10685: URL: https://github.com/apache/druid/pull/10685#discussion_r552810775
########## File path: processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeap.java ########## @@ -59,6 +60,35 @@ public ByteBufferMinMaxOffsetHeap( this.heapIndexUpdater = heapIndexUpdater; } + public ByteBufferMinMaxOffsetHeap copy() + { + LimitedBufferHashGrouper.BufferGrouperOffsetHeapIndexUpdater updater = + Optional + .ofNullable(heapIndexUpdater) + .map(LimitedBufferHashGrouper.BufferGrouperOffsetHeapIndexUpdater::copy) + .orElse(null); + + // deep copy buf + ByteBuffer buffer = ByteBuffer.allocateDirect(buf.capacity()); Review comment: Yeah, I agree. My biggest concern with this code is that it is not obvious to the caller that creating new iterators of the type being changed here will allocate new off-heap memory in an unbounded fashion. This is ok if we think that not "too many" copies will be done but I cannot affirm that. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org