hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject [42/50] [abbrv] hive git commit: HIVE-11501 : Make Connections.setReadOnly method compliant (Michal Wegrzyn via Sergey Shelukhin)
Date Tue, 25 Aug 2015 21:29:12 GMT
HIVE-11501 : Make Connections.setReadOnly method compliant (Michal Wegrzyn via Sergey Shelukhin)


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

Branch: refs/heads/llap
Commit: f7ebff0057c8b16f44d03feb96f8a58e2ee848b0
Parents: 2de6fda
Author: Michał Węgrzyn <michal.wegrzyn@gmail.com>
Authored: Sat Aug 8 10:27:35 2015 +0200
Committer: Ashutosh Chauhan <hashutosh@apache.org>
Committed: Sun Aug 23 22:13:52 2015 -0700

----------------------------------------------------------------------
 jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/f7ebff00/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
----------------------------------------------------------------------
diff --git a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
index bb2b695..3b7e004 100644
--- a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
+++ b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
@@ -1279,8 +1279,16 @@ public class HiveConnection implements java.sql.Connection {
 
   @Override
   public void setReadOnly(boolean readOnly) throws SQLException {
-    // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    // Per JDBC spec, if the connection is closed a SQLException should be thrown.
+    if (isClosed) {
+      throw new SQLException("Connection is closed");
+    }
+    // Per JDBC spec, the request defines a hint to the driver to enable database optimizations.
+    // The read-only mode for this connection is disabled and cannot be enabled (isReadOnly
always returns false).
+    // The most correct behavior is to throw only if the request tries to enable the read-only
mode.
+    if(readOnly) {
+      throw new SQLException("Enabling read-only mode not supported");
+    }
   }
 
   /*


Mime
View raw message