Github user Ben-Zvi commented on a diff in the pull request: https://github.com/apache/drill/pull/1227#discussion_r182910786 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java --- @@ -300,13 +322,14 @@ public void setupHashTable() throws IOException, SchemaChangeException, ClassTra public void executeBuildPhase() throws SchemaChangeException, ClassTransformationException, IOException { //Setup the underlying hash table - // skip first batch if count is zero, as it may be an empty schema batch if (isFurtherProcessingRequired(rightUpstream) && right.getRecordCount() == 0) { for (final VectorWrapper<?> w : right) { w.clear(); } rightUpstream = next(right); + // For build side, use aggregate i.e. average row width across batches + batchMemoryManager.update(RIGHT_INDEX, 0,true); --- End diff -- Why is update() being called when the right has zero rows ? Shouldn't it be called for every new right incoming batch ?
---