fix cleanup methods in ExternalSortBatch and TopNBatch.

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

Branch: refs/heads/master
Commit: ba0a6393cea74c89c6f286a88984de6e3ec3762a
Parents: ecd6410
Author: Steven Phillips <[email protected]>
Authored: Thu Apr 10 12:11:43 2014 -0700
Committer: Jacques Nadeau <[email protected]>
Committed: Sat Apr 19 18:07:12 2014 -0700

----------------------------------------------------------------------
 .../org/apache/drill/exec/physical/impl/TopN/TopNBatch.java  | 8 ++++++--
 .../drill/exec/physical/impl/xsort/ExternalSortBatch.java    | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/ba0a6393/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
index 138c1cf..7073a6c 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
@@ -106,8 +106,12 @@ public class TopNBatch extends AbstractRecordBatch<TopN> {
   @Override
   public void cleanup() {
     super.cleanup();
-    sv4.clear();
-    priorityQueue.cleanup();
+    if (sv4 != null) {
+      sv4.clear();
+    }
+    if (priorityQueue != null) {
+      priorityQueue.cleanup();
+    }
     incoming.cleanup();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/ba0a6393/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 0a3b768..42835fc 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
@@ -148,7 +148,9 @@ public class ExternalSortBatch extends 
AbstractRecordBatch<ExternalSort> {
     if (builder != null) {
       builder.clear();
     }
-    sv4.clear();
+    if (sv4 != null) {
+      sv4.clear();
+    }
   }
 
   @Override

Reply via email to