You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ja...@apache.org on 2014/11/12 05:11:20 UTC

[03/16] incubator-drill git commit: DRILL-1675: Add method to get QueryId from DrillResultSet

DRILL-1675: Add method to get QueryId from DrillResultSet


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

Branch: refs/heads/master
Commit: 836d38a357baac4da93f5f58f91060d58c761781
Parents: b5d5148
Author: Steven Phillips <sp...@maprtech.com>
Authored: Wed Oct 29 13:42:46 2014 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Tue Nov 11 16:48:44 2014 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/drill/jdbc/DrillResultSet.java | 9 +++++++++
 .../java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java  | 2 ++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/836d38a3/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 90d183f..88a6c6d 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
@@ -33,6 +33,7 @@ import org.apache.drill.exec.client.DrillClient;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
 import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
 import org.apache.drill.exec.proto.UserBitShared.QueryType;
+import org.apache.drill.exec.proto.helper.QueryIdHelper;
 import org.apache.drill.exec.record.RecordBatchLoader;
 import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.rpc.user.ConnectionThrottle;
@@ -94,6 +95,14 @@ public class DrillResultSet extends AvaticaResultSet {
     return this;
   }
 
+  public String getQueryId() {
+    if (queryId != null) {
+      return QueryIdHelper.getQueryId(queryId);
+    } else {
+      return null;
+    }
+  }
+
   class Listener implements UserResultsListener {
     private static final int MAX = 100;
     private volatile RpcException ex;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/836d38a3/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
index 4528cee..64e1f02 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
@@ -26,6 +26,7 @@ import java.sql.Statement;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.drill.common.util.TestTools;
+import org.apache.drill.jdbc.DrillResultSet;
 import org.apache.drill.jdbc.Driver;
 import org.apache.drill.jdbc.JdbcTest;
 import org.junit.Rule;
@@ -52,6 +53,7 @@ public class JdbcTestQueryBase extends JdbcTest {
         Stopwatch watch = new Stopwatch().start();
         Statement s = c.createStatement();
         ResultSet r = s.executeQuery(sql);
+        System.out.println(String.format("QueryId: %s", ((DrillResultSet) r).getQueryId()));
         boolean first = true;
         while (r.next()) {
           ResultSetMetaData md = r.getMetaData();