Github user parthchandra commented on a diff in the pull request:
https://github.com/apache/drill/pull/1237#discussion_r185064842
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java
---
@@ -182,13 +189,15 @@ public IterOutcome next() {
return IterOutcome.OUT_OF_MEMORY;
}
+ // Transfer the ownership of this raw-batch to this operator for
proper memory statistics reporting
+ batch = batch.transferBodyOwnership(oContext.getAllocator());
--- End diff --
This should probably be done inside the [ RecordBatchLoader.load()
](https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatchLoader.java#L78)
method.
Note that `MergingRecordBatch` has similar code and so probably suffers
from the same memory accounting issue. All other uses of
`RecordBatchLoader.load()` appear to be in the client code or test code so we
are unlikely to break anything by making the change in `RecordBatchLoader`.
---