You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2015/04/17 20:35:44 UTC

[5/8] incubator-calcite git commit: Test case and NPE patch for [CALCITE-661] Remote fetch in Calcite JDBC driver (Yeong Wei)

Test case and NPE patch for [CALCITE-661] Remote fetch in Calcite JDBC driver (Yeong Wei)


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

Branch: refs/heads/master
Commit: 88a6c5bdd2437eecabe05181c892957ff6b1ac5c
Parents: ca871d3
Author: Julian Hyde <jh...@apache.org>
Authored: Wed Apr 15 09:24:55 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Thu Apr 16 17:53:21 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/calcite/jdbc/CalciteMetaImpl.java   |  5 +++--
 .../apache/calcite/jdbc/CalciteRemoteDriverTest.java    | 12 ++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/88a6c5bd/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java b/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
index 90c711e..455e55e 100644
--- a/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
+++ b/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
@@ -471,8 +471,9 @@ public class CalciteMetaImpl extends MetaImpl {
     final StatementHandle h = createStatement(ch);
     final CalciteConnectionImpl calciteConnection = getConnection();
     CalciteServerStatement statement = calciteConnection.server.getStatement(h);
-    calciteConnection.parseQuery(sql, statement.createPrepareContext(),
-        maxRowCount);
+    h.signature =
+        calciteConnection.parseQuery(sql, statement.createPrepareContext(),
+            maxRowCount);
     return h;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/88a6c5bd/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java b/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
index a702657..c19216a 100644
--- a/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
+++ b/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
@@ -408,6 +408,18 @@ public class CalciteRemoteDriverTest {
     remoteConnection.createStatement().getMoreResults();
   }
 
+  @Test public void testRemotePreparedStatement() throws Exception {
+    final PreparedStatement preparedStatement =
+        remoteConnection.prepareStatement("select * from \"hr\".\"emps\"");
+    ResultSet resultSet = preparedStatement.executeQuery();
+    int count = 0;
+    while (resultSet.next()) {
+      count += 1;
+    }
+    // TODO: implement remote fetch
+    //assertTrue(count > 0);
+  }
+
   /** A bunch of sample values of various types. */
   private static final List<Object> SAMPLE_VALUES =
       ImmutableList.<Object>of(false, true,