You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/01/06 17:01:53 UTC

[GitHub] [druid] loquisgon commented on a change in pull request #10685: Subtotal queries give incorrect results if query has a limit spec

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org