drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adene...@apache.org
Subject drill git commit: DRILL-3707: Fix for DRILL-3616 can cause a NullPointerException in ExternalSort cleanup
Date Wed, 02 Sep 2015 16:12:09 GMT
Repository: drill
Updated Branches:
  refs/heads/master b0e9e7c08 -> 3ad9a42b0


DRILL-3707: Fix for DRILL-3616 can cause a NullPointerException in ExternalSort cleanup

This closes #130


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/3ad9a42b
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/3ad9a42b
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/3ad9a42b

Branch: refs/heads/master
Commit: 3ad9a42b0741c509b625f21854bede70fca16cae
Parents: b0e9e7c
Author: adeneche <adeneche@gmail.com>
Authored: Tue Aug 25 12:25:24 2015 -0700
Committer: adeneche <adeneche@gmail.com>
Committed: Wed Sep 2 09:11:23 2015 -0700

----------------------------------------------------------------------
 .../exec/physical/impl/xsort/ExternalSortBatch.java    | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/3ad9a42b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
index 67158e6..d9866bb 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
@@ -348,8 +348,11 @@ public class ExternalSortBatch extends AbstractRecordBatch<ExternalSort>
{
                 logger.info("Merging spills");
                 spilledBatchGroups.addFirst(mergeAndSpill(spilledBatchGroups));
               }
-              spilledBatchGroups.add(mergeAndSpill(batchGroups));
-              batchesSinceLastSpill = 0;
+              final BatchGroup merged = mergeAndSpill(batchGroups);
+              if (merged != null) { // make sure we don't add null to spilledBatchGroups
+                spilledBatchGroups.add(merged);
+                batchesSinceLastSpill = 0;
+              }
             }
             long t = w.elapsed(TimeUnit.MICROSECONDS);
 //          logger.debug("Took {} us to sort {} records", t, count);
@@ -417,8 +420,12 @@ public class ExternalSortBatch extends AbstractRecordBatch<ExternalSort>
{
 //        logger.debug("Took {} us to sort {} records", t, sv4.getTotalCount());
         container.buildSchema(SelectionVectorMode.FOUR_BYTE);
       } else {
-        spilledBatchGroups.add(mergeAndSpill(batchGroups));
+        final BatchGroup merged = mergeAndSpill(batchGroups);
+        if (merged != null) {
+          spilledBatchGroups.add(merged);
+        }
         batchGroups.addAll(spilledBatchGroups);
+        spilledBatchGroups = null; // no need to cleanup spilledBatchGroups, all it's batches
are in batchGroups now
         logger.warn("Starting to merge. {} batch groups. Current allocated memory: {}", batchGroups.size(),
oContext.getAllocator().getAllocatedMemory());
         VectorContainer hyperBatch = constructHyperBatch(batchGroups);
         createCopier(hyperBatch, batchGroups, container, false);


Mime
View raw message