Github user sachouche commented on a diff in the pull request:
https://github.com/apache/drill/pull/1237#discussion_r184151186
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java
---
@@ -182,13 +184,18 @@ 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());
+
final RecordBatchDef rbd = batch.getHeader().getDef();
final boolean schemaChanged = batchLoader.load(rbd, batch.getBody());
// TODO: Clean: DRILL-2933: That load(...) no longer throws
// SchemaChangeException, so check/clean catch clause below.
stats.addLongStat(Metric.BYTES_RECEIVED, batch.getByteCount());
batch.release();
+ batch = null;
--- End diff --
@vrozov
My bad, the highlight was on the "batch = null" code; I guess, you meant
why can't we move the whole release logic within the finally block. I agree
with your proposal as delaying a bit the release phase doesn't hurt u in this
case. I will make the change.
---