drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject drill git commit: DRILL-1378: Ctrl-C to cancel a query that has not returned with the first result set.
Date Thu, 26 Feb 2015 01:25:21 GMT
Repository: drill
Updated Branches:
  refs/heads/master f7ef5ec78 -> 471013836


DRILL-1378: Ctrl-C to cancel a query that has not returned with the first result set.


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

Branch: refs/heads/master
Commit: 471013836419185d51a2d57bf5b89c4087053255
Parents: f7ef5ec
Author: Parth Chandra <pchandra@maprtech.com>
Authored: Wed Feb 25 09:56:12 2015 -0800
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Wed Feb 25 17:24:54 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/drill/jdbc/DrillResultSet.java | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/47101383/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillResultSet.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillResultSet.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillResultSet.java
index 88a6c6d..77b2c37 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillResultSet.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillResultSet.java
@@ -76,6 +76,20 @@ public class DrillResultSet extends AvaticaResultSet {
     listener.close();
   }
 
+  @Override
+  public boolean next() throws SQLException {
+    // Next may be called after close has been called (for example after a user cancel) which
in turn
+    // sets the cursor to null. So we must check before we call next.
+    // TODO: handle next() after close is called in the Avatica code.
+    if(super.cursor!=null){
+      return super.next();
+    }else{
+      return false;
+    }
+
+  }
+
+
   @Override protected DrillResultSet execute() throws SQLException{
     // Call driver's callback. It is permitted to throw a RuntimeException.
     DrillConnectionImpl connection = (DrillConnectionImpl) statement.getConnection();
@@ -200,6 +214,9 @@ public class DrillResultSet extends AvaticaResultSet {
           qrb.getData().release();
         }
       }
+      // close may be called before the first result is received and the main thread is blocked
waiting
+      // for the result. In that case we want to unblock the main thread.
+      latch.countDown();
       completed = true;
     }
 


Mime
View raw message