Repository: zeppelin Updated Branches: refs/heads/master eccfe0076 -> d11221fb8
Revert "ZEPPELIN-1326: make profile to select dependency of hadoop-common for JDBC interpreter" This reverts commit c4319b7751c7b6071bb71dab016970b44496fa99. Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/d11221fb Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/d11221fb Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/d11221fb Branch: refs/heads/master Commit: d11221fb8af5568416ef5041fc2da8b6fa08598b Parents: eccfe00 Author: Prabhjyot Singh <prabhjyotsi...@gmail.com> Authored: Mon Aug 29 14:44:17 2016 +0530 Committer: Prabhjyot Singh <prabhjyotsi...@gmail.com> Committed: Mon Aug 29 14:44:17 2016 +0530 ---------------------------------------------------------------------- jdbc/pom.xml | 2 +- .../apache/zeppelin/jdbc/JDBCInterpreter.java | 83 ++++++++++---------- .../jdbc/security/JDBCSecurityImpl.java | 1 + pom.xml | 74 ----------------- spark-dependencies/pom.xml | 74 +++++++++++++++++ spark/pom.xml | 74 +++++++++++++++++ 6 files changed, 190 insertions(+), 118 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d11221fb/jdbc/pom.xml ---------------------------------------------------------------------- diff --git a/jdbc/pom.xml b/jdbc/pom.xml index 8fce336..f4e97c9 100644 --- a/jdbc/pom.xml +++ b/jdbc/pom.xml @@ -74,7 +74,7 @@ <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> - <version>${hadoop.version}</version> + <version>2.7.2</version> <scope>provided</scope> </dependency> http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d11221fb/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java ---------------------------------------------------------------------- diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java index cb99efd..0eb0dff 100644 --- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java +++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java @@ -26,7 +26,7 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.*; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.security.UserGroupInformation; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.InterpreterContext; @@ -167,7 +167,7 @@ public class JDBCInterpreter extends Interpreter { logger.debug("propertiesMap: {}", propertiesMap); - if (!StringUtils.isEmpty(property.getProperty("zeppelin.jdbc.auth.type"))) { + if (!StringUtils.isAnyEmpty(property.getProperty("zeppelin.jdbc.auth.type"))) { JDBCSecurityImpl.createSecureConfiguration(property); } for (String propertyKey : propertiesMap.keySet()) { @@ -214,52 +214,49 @@ public class JDBCInterpreter extends Interpreter { Class.forName(properties.getProperty(DRIVER_KEY)); final String url = properties.getProperty(URL_KEY); - if (StringUtils.isEmpty(property.getProperty("zeppelin.jdbc.auth.type"))) { - connection = DriverManager.getConnection(url, properties); - } else { - UserGroupInformation.AuthenticationMethod authType = JDBCSecurityImpl.getAuthtype(property); - switch (authType) { - case KERBEROS: - if (user == null) { - connection = DriverManager.getConnection(url, properties); + UserGroupInformation.AuthenticationMethod authType = JDBCSecurityImpl.getAuthtype(property); + switch (authType) { + case KERBEROS: + if (user == null) { + connection = DriverManager.getConnection(url, properties); + } else { + if ("hive".equalsIgnoreCase(propertyKey)) { + connection = DriverManager.getConnection(url + ";hive.server2.proxy.user=" + user, + properties); } else { - if ("hive".equalsIgnoreCase(propertyKey)) { - connection = DriverManager.getConnection(url + ";hive.server2.proxy.user=" + user, - properties); - } else { - UserGroupInformation ugi = null; - try { - ugi = UserGroupInformation.createProxyUser(user, - UserGroupInformation.getCurrentUser()); - } catch (Exception e) { - logger.error("Error in createProxyUser", e); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(e.getMessage()).append("\n"); - stringBuilder.append(e.getCause()); - throw new InterpreterException(stringBuilder.toString()); - } - try { - connection = ugi.doAs(new PrivilegedExceptionAction<Connection>() { - @Override - public Connection run() throws Exception { - return DriverManager.getConnection(url, properties); - } - }); - } catch (Exception e) { - logger.error("Error in doAs", e); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(e.getMessage()).append("\n"); - stringBuilder.append(e.getCause()); - throw new InterpreterException(stringBuilder.toString()); - } + UserGroupInformation ugi = null; + try { + ugi = UserGroupInformation.createProxyUser(user, + UserGroupInformation.getCurrentUser()); + } catch (Exception e) { + logger.error("Error in createProxyUser", e); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(e.getMessage()).append("\n"); + stringBuilder.append(e.getCause()); + throw new InterpreterException(stringBuilder.toString()); + } + try { + connection = ugi.doAs(new PrivilegedExceptionAction<Connection>() { + @Override + public Connection run() throws Exception { + return DriverManager.getConnection(url, properties); + } + }); + } catch (Exception e) { + logger.error("Error in doAs", e); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(e.getMessage()).append("\n"); + stringBuilder.append(e.getCause()); + throw new InterpreterException(stringBuilder.toString()); } } - break; + } + break; - default: - connection = DriverManager.getConnection(url, properties); - } + default: + connection = DriverManager.getConnection(url, properties); } + } propertyKeySqlCompleterMap.put(propertyKey, createSqlCompleter(connection)); return connection; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d11221fb/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java ---------------------------------------------------------------------- diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java b/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java index 32a7990..8cc2735 100644 --- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java +++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java @@ -18,6 +18,7 @@ package org.apache.zeppelin.jdbc.security; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.zeppelin.jdbc.SqlCompleter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d11221fb/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 76d319f..cd08740 100644 --- a/pom.xml +++ b/pom.xml @@ -657,80 +657,6 @@ <profiles> <profile> - <id>hadoop-0.23</id> - <!-- SPARK-1121: Adds an explicit dependency on Avro to work around a - Hadoop 0.23.X issue --> - <dependencies> - <dependency> - <groupId>org.apache.avro</groupId> - <artifactId>avro</artifactId> - </dependency> - </dependencies> - <properties> - <hadoop.version>0.23.10</hadoop.version> - </properties> - </profile> - - <profile> - <id>hadoop-1</id> - <properties> - <hadoop.version>1.0.4</hadoop.version> - <avro.mapred.classifier>hadoop1</avro.mapred.classifier> - <codehaus.jackson.version>1.8.8</codehaus.jackson.version> - <akka.group>org.spark-project.akka</akka.group> - </properties> - </profile> - - <profile> - <id>hadoop-2.2</id> - <properties> - <hadoop.version>2.2.0</hadoop.version> - <protobuf.version>2.5.0</protobuf.version> - <avro.mapred.classifier>hadoop2</avro.mapred.classifier> - </properties> - </profile> - - <profile> - <id>hadoop-2.3</id> - <properties> - <hadoop.version>2.3.0</hadoop.version> - <protobuf.version>2.5.0</protobuf.version> - <jets3t.version>0.9.3</jets3t.version> - <avro.mapred.classifier>hadoop2</avro.mapred.classifier> - </properties> - </profile> - - <profile> - <id>hadoop-2.4</id> - <properties> - <hadoop.version>2.4.0</hadoop.version> - <protobuf.version>2.5.0</protobuf.version> - <jets3t.version>0.9.3</jets3t.version> - <avro.mapred.classifier>hadoop2</avro.mapred.classifier> - </properties> - </profile> - - <profile> - <id>hadoop-2.6</id> - <properties> - <hadoop.version>2.6.0</hadoop.version> - <protobuf.version>2.5.0</protobuf.version> - <jets3t.version>0.9.3</jets3t.version> - <avro.mapred.classifier>hadoop2</avro.mapred.classifier> - </properties> - </profile> - - <profile> - <id>hadoop-2.7</id> - <properties> - <hadoop.version>2.7.2</hadoop.version> - <protobuf.version>2.5.0</protobuf.version> - <jets3t.version>0.9.0</jets3t.version> - <avro.mapred.classifier>hadoop2</avro.mapred.classifier> - </properties> - </profile> - - <profile> <id>scala-2.10</id> <activation> <activeByDefault>true</activeByDefault> http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d11221fb/spark-dependencies/pom.xml ---------------------------------------------------------------------- diff --git a/spark-dependencies/pom.xml b/spark-dependencies/pom.xml index ed2d322..7da976a 100644 --- a/spark-dependencies/pom.xml +++ b/spark-dependencies/pom.xml @@ -533,6 +533,80 @@ </profile> <profile> + <id>hadoop-0.23</id> + <!-- SPARK-1121: Adds an explicit dependency on Avro to work around a + Hadoop 0.23.X issue --> + <dependencies> + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro</artifactId> + </dependency> + </dependencies> + <properties> + <hadoop.version>0.23.10</hadoop.version> + </properties> + </profile> + + <profile> + <id>hadoop-1</id> + <properties> + <hadoop.version>1.0.4</hadoop.version> + <avro.mapred.classifier>hadoop1</avro.mapred.classifier> + <codehaus.jackson.version>1.8.8</codehaus.jackson.version> + <akka.group>org.spark-project.akka</akka.group> + </properties> + </profile> + + <profile> + <id>hadoop-2.2</id> + <properties> + <hadoop.version>2.2.0</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> + <id>hadoop-2.3</id> + <properties> + <hadoop.version>2.3.0</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <jets3t.version>0.9.3</jets3t.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> + <id>hadoop-2.4</id> + <properties> + <hadoop.version>2.4.0</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <jets3t.version>0.9.3</jets3t.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> + <id>hadoop-2.6</id> + <properties> + <hadoop.version>2.6.0</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <jets3t.version>0.9.3</jets3t.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> + <id>hadoop-2.7</id> + <properties> + <hadoop.version>2.7.2</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <jets3t.version>0.9.0</jets3t.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> <id>mapr3</id> <activation> <activeByDefault>false</activeByDefault> http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d11221fb/spark/pom.xml ---------------------------------------------------------------------- diff --git a/spark/pom.xml b/spark/pom.xml index d2bed9f..5dcbb51 100644 --- a/spark/pom.xml +++ b/spark/pom.xml @@ -659,6 +659,80 @@ </profile> <profile> + <id>hadoop-0.23</id> + <!-- SPARK-1121: Adds an explicit dependency on Avro to work around a + Hadoop 0.23.X issue --> + <dependencies> + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro</artifactId> + </dependency> + </dependencies> + <properties> + <hadoop.version>0.23.10</hadoop.version> + </properties> + </profile> + + <profile> + <id>hadoop-1</id> + <properties> + <hadoop.version>1.0.4</hadoop.version> + <avro.mapred.classifier>hadoop1</avro.mapred.classifier> + <codehaus.jackson.version>1.8.8</codehaus.jackson.version> + <akka.group>org.spark-project.akka</akka.group> + </properties> + </profile> + + <profile> + <id>hadoop-2.2</id> + <properties> + <hadoop.version>2.2.0</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> + <id>hadoop-2.3</id> + <properties> + <hadoop.version>2.3.0</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <jets3t.version>0.9.3</jets3t.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> + <id>hadoop-2.4</id> + <properties> + <hadoop.version>2.4.0</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <jets3t.version>0.9.3</jets3t.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> + <id>hadoop-2.6</id> + <properties> + <hadoop.version>2.6.0</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <jets3t.version>0.9.3</jets3t.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> + <id>hadoop-2.7</id> + <properties> + <hadoop.version>2.7.2</hadoop.version> + <protobuf.version>2.5.0</protobuf.version> + <jets3t.version>0.9.0</jets3t.version> + <avro.mapred.classifier>hadoop2</avro.mapred.classifier> + </properties> + </profile> + + <profile> <id>mapr3</id> <activation> <activeByDefault>false</activeByDefault>