You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by pa...@apache.org on 2015/04/25 01:22:43 UTC

[08/11] drill git commit: DRILL-2782: 1-Hygiene: Various cleanup.

DRILL-2782: 1-Hygiene: Various cleanup.

- Fixed/moved checkNotClosed to after constructor.
- Removed redundant "public"; "privatized" logger.
- Purged unused imports.
- A little commenting, editing, wrapping.


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

Branch: refs/heads/master
Commit: 6e477e2862446c64c6a591d94703921cd9c92e6b
Parents: a6256b1
Author: dbarclay <db...@maprtech.com>
Authored: Tue Apr 14 16:17:30 2015 -0700
Committer: Parth Chandra <pc...@maprtech.com>
Committed: Fri Apr 24 16:21:54 2015 -0700

----------------------------------------------------------------------
 .../org/apache/drill/jdbc/DrillConnection.java  | 17 +++++++---
 .../apache/drill/jdbc/DrillConnectionImpl.java  | 35 +++++++++-----------
 .../java/org/apache/drill/jdbc/MetaImpl.java    |  2 +-
 3 files changed, 29 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/6e477e28/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java
index a52644d..6bacaad 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java
@@ -24,18 +24,27 @@ import java.sql.SQLException;
 import org.apache.drill.exec.client.DrillClient;
 
 
-public interface DrillConnection extends Connection{
+/**
+ * Drill-specific {@link Connection}.
+ * @see #unwrap
+ */
+public interface DrillConnection extends Connection {
 
-  // in java.sql.Connection from JDK 1.7, but declare here to allow other JDKs
+  // In java.sql.Connection from JDK 1.7, but declared here to allow other JDKs.
   void setSchema(String schema) throws SQLException;
 
-  // in java.sql.Connection from JDK 1.7, but declare here to allow other JDKs
+  // In java.sql.Connection from JDK 1.7, but declared here to allow other JDKs.
   String getSchema() throws SQLException;
 
+
+  //////////////////////////////////////////////////////////////////////
+  // Drill extensions.
+
   /** Returns a view onto this connection's configuration properties. Code
    * within Optiq should use this view rather than calling
    * {@link java.util.Properties#getProperty(String)}. */
   DrillConnectionConfig config();
 
-  public DrillClient getClient();
+  DrillClient getClient();
+
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/6e477e28/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java
index 2b18afb..79852a0 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java
@@ -23,7 +23,6 @@ import java.sql.SQLException;
 import java.util.Properties;
 import java.util.TimeZone;
 
-import com.google.common.io.Files;
 import net.hydromatic.avatica.AvaticaConnection;
 import net.hydromatic.avatica.AvaticaFactory;
 import net.hydromatic.avatica.Helper;
@@ -31,18 +30,13 @@ import net.hydromatic.avatica.Meta;
 import net.hydromatic.avatica.UnregisteredDriver;
 
 import org.apache.drill.common.config.DrillConfig;
-import org.apache.drill.common.exceptions.ExecutionSetupException;
 import org.apache.drill.exec.client.DrillClient;
 import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.memory.TopLevelAllocator;
 import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.server.Drillbit;
-import org.apache.drill.exec.server.DrillbitContext;
 import org.apache.drill.exec.server.RemoteServiceSet;
 import org.apache.drill.exec.store.StoragePluginRegistry;
-import org.apache.drill.exec.store.dfs.FileSystemConfig;
-import org.apache.drill.exec.store.dfs.FileSystemPlugin;
-import org.apache.drill.exec.store.dfs.WorkspaceConfig;
 import org.apache.drill.exec.util.TestUtilities;
 
 // (Public until JDBC impl. classes moved out of published-intf. package. (DRILL-2089).)
@@ -53,8 +47,9 @@ import org.apache.drill.exec.util.TestUtilities;
  * Abstract to allow newer versions of JDBC to add methods.
  * </p>
  */
-public abstract class DrillConnectionImpl extends AvaticaConnection implements DrillConnection {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillConnection.class);
+public abstract class DrillConnectionImpl extends AvaticaConnection
+                                          implements DrillConnection {
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillConnection.class);
 
   final DrillStatementRegistry openStatementsRegistry = new DrillStatementRegistry();
   final DrillConnectionConfig config;
@@ -64,18 +59,6 @@ public abstract class DrillConnectionImpl extends AvaticaConnection implements D
   private Drillbit bit;
   private RemoteServiceSet serviceSet;
 
-  /**
-   * Throws AlreadyClosedSqlException if this Connection is closed.
-   *
-   * @throws AlreadyClosedSqlException if Connection is closed
-   * @throws SQLException if error in calling {@link #isClosed()}
-   */
-  private void checkNotClosed() throws SQLException {
-    if ( isClosed() ) {
-      throw new AlreadyClosedSqlException( "Connection is already closed." );
-    }
-  }
-
   protected DrillConnectionImpl(Driver driver, AvaticaFactory factory, String url, Properties info) throws SQLException {
     super(driver, factory, url, info);
     this.config = new DrillConnectionConfig(info);
@@ -130,6 +113,18 @@ public abstract class DrillConnectionImpl extends AvaticaConnection implements D
     }
   }
 
+  /**
+   * Throws AlreadyClosedSqlException if this Connection is closed.
+   *
+   * @throws AlreadyClosedSqlException if Connection is closed
+   * @throws SQLException if error in calling {@link #isClosed()}
+   */
+  private void checkNotClosed() throws SQLException {
+    if ( isClosed() ) {
+      throw new AlreadyClosedSqlException( "Connection is already closed." );
+    }
+  }
+
   @Override
   public DrillConnectionConfig config() {
     return config;

http://git-wip-us.apache.org/repos/asf/drill/blob/6e477e28/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java
index 78ca221..2ac0b91 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/MetaImpl.java
@@ -168,7 +168,7 @@ public class MetaImpl implements Meta {
   }
 
   /**
-   * Implements @link DatabaseMetaData#getColumns()}.
+   * Implements {@link DatabaseMetaData#getColumns()}.
    */
   public ResultSet getColumns(String catalog, Pat schemaPattern,
                               Pat tableNamePattern, Pat columnNamePattern) {