From 7e6b84f2d344905c18c59316b9c5f39caa09c9a5 Mon Sep 17 00:00:00 2001 From: Jongyoul Lee Date: Fri, 10 Jun 2016 00:48:29 +0900 Subject: [PATCH] - Removed Phoenix Interpreter - Updated example for using Apache Phoenix --- conf/zeppelin-site.xml.template | 2 +- docs/interpreter/jdbc.md | 36 +++ docs/rest-api/rest-configuration.md | 2 +- phoenix/pom.xml | 149 ----------- .../zeppelin/phoenix/PhoenixInterpreter.java | 240 ------------------ .../phoenix/PhoenixInterpreterTest.java | 226 ----------------- pom.xml | 1 - zeppelin-distribution/src/bin_license/LICENSE | 1 - .../zeppelin/conf/ZeppelinConfiguration.java | 1 - 9 files changed, 38 insertions(+), 620 deletions(-) delete mode 100644 phoenix/pom.xml delete mode 100644 phoenix/src/main/java/org/apache/zeppelin/phoenix/PhoenixInterpreter.java delete mode 100644 phoenix/src/test/java/org/apache/zeppelin/phoenix/PhoenixInterpreterTest.java diff --git a/conf/zeppelin-site.xml.template b/conf/zeppelin-site.xml.template index 11ad8660cd9..6c1ff8a19bc 100755 --- a/conf/zeppelin-site.xml.template +++ b/conf/zeppelin-site.xml.template @@ -178,7 +178,7 @@ zeppelin.interpreters - org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.rinterpreter.RRepl,org.apache.zeppelin.rinterpreter.KnitR,org.apache.zeppelin.spark.SparkRInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.file.HDFSFileInterpreter,org.apache.zeppelin.flink.FlinkInterpreter,,org.apache.zeppelin.python.PythonInterpreter,org.apache.zeppelin.lens.LensInterpreter,org.apache.zeppelin.ignite.IgniteInterpreter,org.apache.zeppelin.ignite.IgniteSqlInterpreter,org.apache.zeppelin.cassandra.CassandraInterpreter,org.apache.zeppelin.geode.GeodeOqlInterpreter,org.apache.zeppelin.postgresql.PostgreSqlInterpreter,org.apache.zeppelin.jdbc.JDBCInterpreter,org.apache.zeppelin.phoenix.PhoenixInterpreter,org.apache.zeppelin.kylin.KylinInterpreter,org.apache.zeppelin.elasticsearch.ElasticsearchInterpreter,org.apache.zeppelin.scalding.ScaldingInterpreter,org.apache.zeppelin.alluxio.AlluxioInterpreter,org.apache.zeppelin.hbase.HbaseInterpreter,org.apache.zeppelin.livy.LivySparkInterpreter,org.apache.zeppelin.livy.LivyPySparkInterpreter,org.apache.zeppelin.livy.LivySparkRInterpreter,org.apache.zeppelin.livy.LivySparkSQLInterpreter + org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.rinterpreter.RRepl,org.apache.zeppelin.rinterpreter.KnitR,org.apache.zeppelin.spark.SparkRInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.file.HDFSFileInterpreter,org.apache.zeppelin.flink.FlinkInterpreter,,org.apache.zeppelin.python.PythonInterpreter,org.apache.zeppelin.lens.LensInterpreter,org.apache.zeppelin.ignite.IgniteInterpreter,org.apache.zeppelin.ignite.IgniteSqlInterpreter,org.apache.zeppelin.cassandra.CassandraInterpreter,org.apache.zeppelin.geode.GeodeOqlInterpreter,org.apache.zeppelin.postgresql.PostgreSqlInterpreter,org.apache.zeppelin.jdbc.JDBCInterpreter,org.apache.zeppelin.kylin.KylinInterpreter,org.apache.zeppelin.elasticsearch.ElasticsearchInterpreter,org.apache.zeppelin.scalding.ScaldingInterpreter,org.apache.zeppelin.alluxio.AlluxioInterpreter,org.apache.zeppelin.hbase.HbaseInterpreter,org.apache.zeppelin.livy.LivySparkInterpreter,org.apache.zeppelin.livy.LivyPySparkInterpreter,org.apache.zeppelin.livy.LivySparkRInterpreter,org.apache.zeppelin.livy.LivySparkSQLInterpreter Comma separated interpreter configurations. First interpreter become a default diff --git a/docs/interpreter/jdbc.md b/docs/interpreter/jdbc.md index 6783aac2fa1..82201471b93 100644 --- a/docs/interpreter/jdbc.md +++ b/docs/interpreter/jdbc.md @@ -18,6 +18,7 @@ This interpreter lets you create a JDBC connection to any data source, by now it * Apache Hive * Apache Drill * Details on using [Drill JDBC Driver](https://drill.apache.org/docs/using-the-jdbc-driver) +* Apache Phoenix * Apache Tajo If someone else used another database please report how it works to improve functionality. @@ -236,6 +237,41 @@ To develop this functionality use this [method](http://docs.oracle.com/javase/7/ +#### Phoenix +##### Properties + + + + + + + + + + + + + + + + + + + + + +
NameValue
phoenix.driverorg.apache.phoenix.jdbc.PhoenixDriver
phoenix.urljdbc:phoenix:localhost:2181:/hbase-unsecure
phoenix.userphoenix_user
phoenix.passwordphoenix_password
+##### Dependencies + + + + + + + + + +
ArtifactExcludes
org.apache.phoenix:phoenix-core:4.4.0-HBase-1.0
#### Tajo ##### Properties diff --git a/docs/rest-api/rest-configuration.md b/docs/rest-api/rest-configuration.md index 45cccec6c7e..e445156a2aa 100644 --- a/docs/rest-api/rest-configuration.md +++ b/docs/rest-api/rest-configuration.md @@ -73,7 +73,7 @@ limitations under the License. "zeppelin.server.context.path": "/", "zeppelin.ssl.keystore.type": "JKS", "zeppelin.ssl.truststore.path": "truststore", - "zeppelin.interpreters": "org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.spark.SparkRInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.flink.FlinkInterpreter,org.apache.zeppelin.lens.LensInterpreter,org.apache.zeppelin.ignite.IgniteInterpreter,org.apache.zeppelin.ignite.IgniteSqlInterpreter,org.apache.zeppelin.cassandra.CassandraInterpreter,org.apache.zeppelin.geode.GeodeOqlInterpreter,org.apache.zeppelin.postgresql.PostgreSqlInterpreter,org.apache.zeppelin.phoenix.PhoenixInterpreter,org.apache.zeppelin.kylin.KylinInterpreter,org.apache.zeppelin.elasticsearch.ElasticsearchInterpreter,org.apache.zeppelin.scalding.ScaldingInterpreter", + "zeppelin.interpreters": "org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.spark.SparkRInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.flink.FlinkInterpreter,org.apache.zeppelin.lens.LensInterpreter,org.apache.zeppelin.ignite.IgniteInterpreter,org.apache.zeppelin.ignite.IgniteSqlInterpreter,org.apache.zeppelin.cassandra.CassandraInterpreter,org.apache.zeppelin.geode.GeodeOqlInterpreter,org.apache.zeppelin.postgresql.PostgreSqlInterpreter,org.apache.zeppelin.kylin.KylinInterpreter,org.apache.zeppelin.elasticsearch.ElasticsearchInterpreter,org.apache.zeppelin.scalding.ScaldingInterpreter", "zeppelin.ssl": "false", "zeppelin.notebook.autoInterpreterBinding": "true", "zeppelin.notebook.homescreen": "", diff --git a/phoenix/pom.xml b/phoenix/pom.xml deleted file mode 100644 index de4c104b669..00000000000 --- a/phoenix/pom.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - 4.0.0 - - - zeppelin - org.apache.zeppelin - 0.6.0-SNAPSHOT - - - org.apache.zeppelin - zeppelin-phoenix - jar - 0.6.0-SNAPSHOT - Zeppelin: Apache Phoenix Interpreter - Zeppelin interprter for Apache Phoenix - http://zeppelin.apache.org - - - 4.4.0-HBase-1.0 - - - - - org.apache.zeppelin - zeppelin-interpreter - ${project.version} - provided - - - - sqlline - sqlline - 1.1.9 - - - - org.apache.phoenix - phoenix-core - ${phoenix.version} - - - - junit - junit - test - - - - org.mockito - mockito-all - 1.9.5 - test - - - - com.mockrunner - mockrunner-jdbc - 1.0.8 - test - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.7 - - true - - - - - maven-enforcer-plugin - 1.3.1 - - - enforce - none - - - - - - maven-dependency-plugin - 2.8 - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory}/../../interpreter/phoenix - false - false - true - runtime - - - - copy-artifact - package - - copy - - - ${project.build.directory}/../../interpreter/phoenix - false - false - true - runtime - - - ${project.groupId} - ${project.artifactId} - ${project.version} - ${project.packaging} - - - - - - - - - - diff --git a/phoenix/src/main/java/org/apache/zeppelin/phoenix/PhoenixInterpreter.java b/phoenix/src/main/java/org/apache/zeppelin/phoenix/PhoenixInterpreter.java deleted file mode 100644 index 05d5d313f46..00000000000 --- a/phoenix/src/main/java/org/apache/zeppelin/phoenix/PhoenixInterpreter.java +++ /dev/null @@ -1,240 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.phoenix; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.List; -import java.util.Properties; - -import org.apache.commons.lang.StringUtils; -import org.apache.zeppelin.interpreter.Interpreter; -import org.apache.zeppelin.interpreter.InterpreterContext; -import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder; -import org.apache.zeppelin.interpreter.InterpreterResult; -import org.apache.zeppelin.interpreter.InterpreterResult.Code; -import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; -import org.apache.zeppelin.scheduler.Scheduler; -import org.apache.zeppelin.scheduler.SchedulerFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Phoenix interpreter for Zeppelin. - */ -public class PhoenixInterpreter extends Interpreter { - Logger logger = LoggerFactory.getLogger(PhoenixInterpreter.class); - - private static final String EXPLAIN_PREDICATE = "EXPLAIN "; - private static final String UPDATE_HEADER = "UPDATES "; - - private static final String WS = " "; - private static final String NEWLINE = "\n"; - private static final String TAB = "\t"; - private static final String TABLE_MAGIC_TAG = "%table "; - - static final String PHOENIX_JDBC_URL = "phoenix.jdbc.url"; - static final String PHOENIX_JDBC_USER = "phoenix.user"; - static final String PHOENIX_JDBC_PASSWORD = "phoenix.password"; - static final String PHOENIX_MAX_RESULT = "phoenix.max.result"; - static final String PHOENIX_JDBC_DRIVER_NAME = "phoenix.driver.name"; - - static final String DEFAULT_JDBC_URL = "jdbc:phoenix:localhost:2181:/hbase-unsecure"; - static final String DEFAULT_JDBC_USER = ""; - static final String DEFAULT_JDBC_PASSWORD = ""; - static final String DEFAULT_MAX_RESULT = "1000"; - static final String DEFAULT_JDBC_DRIVER_NAME = "org.apache.phoenix.jdbc.PhoenixDriver"; - - private Connection jdbcConnection; - private Statement currentStatement; - private Exception exceptionOnConnect; - private int maxResult; - - static { - Interpreter.register( - "sql", - "phoenix", - PhoenixInterpreter.class.getName(), - new InterpreterPropertyBuilder() - .add(PHOENIX_JDBC_URL, DEFAULT_JDBC_URL, "Phoenix JDBC connection string") - .add(PHOENIX_JDBC_USER, DEFAULT_JDBC_USER, "The Phoenix user") - .add(PHOENIX_JDBC_PASSWORD, DEFAULT_JDBC_PASSWORD, "The password for the Phoenix user") - .add(PHOENIX_MAX_RESULT, DEFAULT_MAX_RESULT, "Max number of SQL results to display.") - .add(PHOENIX_JDBC_DRIVER_NAME, DEFAULT_JDBC_DRIVER_NAME, "Phoenix Driver classname.") - .build() - ); - } - - public PhoenixInterpreter(Properties property) { - super(property); - } - - @Override - public void open() { - logger.info("Jdbc open connection called!"); - close(); - - try { - Class.forName(getProperty(PHOENIX_JDBC_DRIVER_NAME)); - - maxResult = Integer.valueOf(getProperty(PHOENIX_MAX_RESULT)); - jdbcConnection = DriverManager.getConnection( - getProperty(PHOENIX_JDBC_URL), - getProperty(PHOENIX_JDBC_USER), - getProperty(PHOENIX_JDBC_PASSWORD) - ); - exceptionOnConnect = null; - logger.info("Successfully created Jdbc connection"); - } - catch (ClassNotFoundException | SQLException e) { - logger.error("Cannot open connection", e); - exceptionOnConnect = e; - } - } - - @Override - public void close() { - logger.info("Jdbc close connection called!"); - - try { - if (getJdbcConnection() != null) { - getJdbcConnection().close(); - } - } catch (SQLException e) { - logger.error("Cannot close connection", e); - } - finally { - exceptionOnConnect = null; - } - } - - private String clean(boolean isExplain, String str){ - return (isExplain || str == null) ? str : str.replace(TAB, WS).replace(NEWLINE, WS); - } - - private InterpreterResult executeSql(String sql) { - try { - if (exceptionOnConnect != null) { - return new InterpreterResult(Code.ERROR, exceptionOnConnect.getMessage()); - } - - currentStatement = getJdbcConnection().createStatement(); - - boolean isExplain = StringUtils.containsIgnoreCase(sql, EXPLAIN_PREDICATE); - StringBuilder msg = (isExplain) ? new StringBuilder() : new StringBuilder(TABLE_MAGIC_TAG); - - ResultSet res = null; - try { - boolean hasResult = currentStatement.execute(sql); - if (hasResult){ //If query had results - res = currentStatement.getResultSet(); - //Append column names - ResultSetMetaData md = res.getMetaData(); - String row = clean(isExplain, md.getColumnName(1)); - for (int i = 2; i < md.getColumnCount() + 1; i++) - row += TAB + clean(isExplain, md.getColumnName(i)); - msg.append(row + NEWLINE); - - //Append rows - int rowCount = 0; - while (res.next() && rowCount < getMaxResult()) { - row = clean(isExplain, res.getString(1)); - for (int i = 2; i < md.getColumnCount() + 1; i++) - row += TAB + clean(isExplain, res.getString(i)); - msg.append(row + NEWLINE); - rowCount++; - } - } - else { // May have been upsert or DDL - msg.append(UPDATE_HEADER + NEWLINE + - "Rows affected: " + currentStatement.getUpdateCount() - + NEWLINE); - } - - } finally { - try { - if (res != null) res.close(); - getJdbcConnection().commit(); - currentStatement.close(); - } finally { - currentStatement = null; - } - } - - return new InterpreterResult(Code.SUCCESS, msg.toString()); - } - catch (SQLException ex) { - logger.error("Can not run " + sql, ex); - return new InterpreterResult(Code.ERROR, ex.getMessage()); - } - } - - @Override - public InterpreterResult interpret(String cmd, InterpreterContext contextInterpreter) { - logger.info("Run SQL command '" + cmd + "'"); - return executeSql(cmd); - } - - @Override - public void cancel(InterpreterContext context) { - if (currentStatement != null) { - try { - currentStatement.cancel(); - } - catch (SQLException ex) { - } - finally { - currentStatement = null; - } - } - } - - @Override - public FormType getFormType() { - return FormType.SIMPLE; - } - - @Override - public int getProgress(InterpreterContext context) { - return 0; - } - - @Override - public Scheduler getScheduler() { - return SchedulerFactory.singleton().createOrGetFIFOScheduler( - PhoenixInterpreter.class.getName() + this.hashCode()); - } - - @Override - public List completion(String buf, int cursor) { - return null; - } - - public Connection getJdbcConnection() { - return jdbcConnection; - } - - public int getMaxResult() { - return maxResult; - } - -} diff --git a/phoenix/src/test/java/org/apache/zeppelin/phoenix/PhoenixInterpreterTest.java b/phoenix/src/test/java/org/apache/zeppelin/phoenix/PhoenixInterpreterTest.java deleted file mode 100644 index 9270d4b3973..00000000000 --- a/phoenix/src/test/java/org/apache/zeppelin/phoenix/PhoenixInterpreterTest.java +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.phoenix; - -import static org.apache.zeppelin.phoenix.PhoenixInterpreter.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.times; - -import java.sql.SQLException; -import java.util.Properties; - -import org.apache.zeppelin.interpreter.InterpreterResult; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Matchers; -import org.mockito.Mockito; - -import com.mockrunner.jdbc.BasicJDBCTestCaseAdapter; -import com.mockrunner.jdbc.StatementResultSetHandler; -import com.mockrunner.mock.jdbc.MockConnection; -import com.mockrunner.mock.jdbc.MockResultSet; - -/** - * Phoenix interpreter unit tests - */ -public class PhoenixInterpreterTest extends BasicJDBCTestCaseAdapter { - private PhoenixInterpreter phoenixInterpreter = null; - private MockResultSet result = null; - - @Before - public void beforeTest() { - MockConnection connection = getJDBCMockObjectFactory().getMockConnection(); - - StatementResultSetHandler statementHandler = connection.getStatementResultSetHandler(); - result = statementHandler.createResultSet(); - statementHandler.prepareGlobalResultSet(result); - - Properties properties = new Properties(); - properties.put(PHOENIX_JDBC_DRIVER_NAME, DEFAULT_JDBC_DRIVER_NAME); - properties.put(PHOENIX_JDBC_URL, DEFAULT_JDBC_URL); - properties.put(PHOENIX_JDBC_USER, DEFAULT_JDBC_USER); - properties.put(PHOENIX_JDBC_PASSWORD, DEFAULT_JDBC_PASSWORD); - properties.put(PHOENIX_MAX_RESULT, DEFAULT_MAX_RESULT); - - phoenixInterpreter = spy(new PhoenixInterpreter(properties)); - when(phoenixInterpreter.getJdbcConnection()).thenReturn(connection); - } - - @Test - public void testOpenCommandIdempotency() throws SQLException { - // Ensure that an attempt to open new connection will clean any remaining connections - phoenixInterpreter.open(); - phoenixInterpreter.open(); - phoenixInterpreter.open(); - - verify(phoenixInterpreter, times(3)).open(); - verify(phoenixInterpreter, times(3)).close(); - } - - @Test - public void testDefaultProperties() throws SQLException { - - PhoenixInterpreter phoenixInterpreter = new PhoenixInterpreter(new Properties()); - - assertEquals(DEFAULT_JDBC_DRIVER_NAME, - phoenixInterpreter.getProperty(PHOENIX_JDBC_DRIVER_NAME)); - assertEquals(DEFAULT_JDBC_URL, phoenixInterpreter.getProperty(PHOENIX_JDBC_URL)); - assertEquals(DEFAULT_JDBC_USER, phoenixInterpreter.getProperty(PHOENIX_JDBC_USER)); - assertEquals(DEFAULT_JDBC_PASSWORD, - phoenixInterpreter.getProperty(PHOENIX_JDBC_PASSWORD)); - assertEquals(DEFAULT_MAX_RESULT, phoenixInterpreter.getProperty(PHOENIX_MAX_RESULT)); - } - - @Test - public void testConnectionClose() throws SQLException { - - PhoenixInterpreter phoenixInterpreter = spy(new PhoenixInterpreter(new Properties())); - - when(phoenixInterpreter.getJdbcConnection()).thenReturn( - getJDBCMockObjectFactory().getMockConnection()); - - phoenixInterpreter.close(); - - verifyAllResultSetsClosed(); - verifyAllStatementsClosed(); - verifyConnectionClosed(); - } - - @Test - public void testStatementCancel() throws SQLException { - - PhoenixInterpreter phoenixInterpreter = spy(new PhoenixInterpreter(new Properties())); - - when(phoenixInterpreter.getJdbcConnection()).thenReturn( - getJDBCMockObjectFactory().getMockConnection()); - - phoenixInterpreter.cancel(null); - - verifyAllResultSetsClosed(); - verifyAllStatementsClosed(); - assertFalse("Cancel operation should not close the connection", phoenixInterpreter - .getJdbcConnection().isClosed()); - } - - @Test - public void testSelectQuery() throws SQLException { - - when(phoenixInterpreter.getMaxResult()).thenReturn(1000); - - String sqlQuery = "select * from t"; - - result.addColumn("col1", new String[] {"val11", "val12"}); - result.addColumn("col2", new String[] {"val21", "val22"}); - - InterpreterResult interpreterResult = phoenixInterpreter.interpret(sqlQuery, null); - - assertEquals(InterpreterResult.Code.SUCCESS, interpreterResult.code()); - assertEquals(InterpreterResult.Type.TABLE, interpreterResult.type()); - assertEquals("col1\tcol2\nval11\tval21\nval12\tval22\n", interpreterResult.message()); - - verifySQLStatementExecuted(sqlQuery); - verifyAllResultSetsClosed(); - verifyAllStatementsClosed(); - } - - @Test - public void testSelectQueryMaxResult() throws SQLException { - - when(phoenixInterpreter.getMaxResult()).thenReturn(1); - - String sqlQuery = "select * from t"; - - result.addColumn("col1", new String[] {"val11", "val12"}); - result.addColumn("col2", new String[] {"val21", "val22"}); - - InterpreterResult interpreterResult = phoenixInterpreter.interpret(sqlQuery, null); - - assertEquals(InterpreterResult.Code.SUCCESS, interpreterResult.code()); - assertEquals(InterpreterResult.Type.TABLE, interpreterResult.type()); - assertEquals("col1\tcol2\nval11\tval21\n", interpreterResult.message()); - - verifySQLStatementExecuted(sqlQuery); - verifyAllResultSetsClosed(); - verifyAllStatementsClosed(); - } - - @Test - public void testSelectQueryWithSpecialCharacters() throws SQLException { - - when(phoenixInterpreter.getMaxResult()).thenReturn(1000); - - String sqlQuery = "select * from t"; - - result.addColumn("co\tl1", new String[] {"val11", "va\tl1\n2"}); - result.addColumn("co\nl2", new String[] {"v\nal21", "val\t22"}); - - InterpreterResult interpreterResult = phoenixInterpreter.interpret(sqlQuery, null); - - assertEquals(InterpreterResult.Code.SUCCESS, interpreterResult.code()); - assertEquals(InterpreterResult.Type.TABLE, interpreterResult.type()); - assertEquals("co l1\tco l2\nval11\tv al21\nva l1 2\tval 22\n", interpreterResult.message()); - - verifySQLStatementExecuted(sqlQuery); - verifyAllResultSetsClosed(); - verifyAllStatementsClosed(); - } - - @Test - public void testExplainQuery() throws SQLException { - - when(phoenixInterpreter.getMaxResult()).thenReturn(1000); - - String sqlQuery = "explain select * from t"; - - result.addColumn("col1", new String[] {"val11", "val12"}); - - InterpreterResult interpreterResult = phoenixInterpreter.interpret(sqlQuery, null); - - assertEquals(InterpreterResult.Code.SUCCESS, interpreterResult.code()); - assertEquals(InterpreterResult.Type.TEXT, interpreterResult.type()); - assertEquals("col1\nval11\nval12\n", interpreterResult.message()); - - verifySQLStatementExecuted(sqlQuery); - verifyAllResultSetsClosed(); - verifyAllStatementsClosed(); - } - - @Test - public void testExplainQueryWithSpecialCharachters() throws SQLException { - - when(phoenixInterpreter.getMaxResult()).thenReturn(1000); - - String sqlQuery = "explain select * from t"; - - result.addColumn("co\tl\n1", new String[] {"va\nl11", "va\tl\n12"}); - - InterpreterResult interpreterResult = phoenixInterpreter.interpret(sqlQuery, null); - - assertEquals(InterpreterResult.Code.SUCCESS, interpreterResult.code()); - assertEquals(InterpreterResult.Type.TEXT, interpreterResult.type()); - assertEquals("co\tl\n1\nva\nl11\nva\tl\n12\n", interpreterResult.message()); - - verifySQLStatementExecuted(sqlQuery); - verifyAllResultSetsClosed(); - verifyAllStatementsClosed(); - } -} diff --git a/pom.xml b/pom.xml index d971d9ac983..0d4abc5e63c 100755 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,6 @@ shell livy hbase - phoenix postgresql jdbc file diff --git a/zeppelin-distribution/src/bin_license/LICENSE b/zeppelin-distribution/src/bin_license/LICENSE index 57c7224efa2..a19b7b4fd32 100644 --- a/zeppelin-distribution/src/bin_license/LICENSE +++ b/zeppelin-distribution/src/bin_license/LICENSE @@ -40,7 +40,6 @@ The following components are provided under Apache License. (Apache 2.0) Apache Ignite (http://ignite.apache.org/) (Apache 2.0) Apache Kylin (http://kylin.apache.org/) (Apache 2.0) Apache Lens (http://lens.apache.org/) - (Apache 2.0) Apache Phoenix (http://phoenix.apache.org/) (Apache 2.0) Apache Flink (http://flink.apache.org/) (Apache 2.0) Apache Thrift (http://thrift.apache.org/) (Apache 2.0) Apache Lucene (https://lucene.apache.org/) diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index a7d44981b93..45fbba4d57d 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -493,7 +493,6 @@ public static enum ConfVars { + "org.apache.zeppelin.livy.LivySparkRInterpreter," + "org.apache.zeppelin.alluxio.AlluxioInterpreter," + "org.apache.zeppelin.file.HDFSFileInterpreter," - + "org.apache.zeppelin.phoenix.PhoenixInterpreter," + "org.apache.zeppelin.postgresql.PostgreSqlInterpreter," + "org.apache.zeppelin.flink.FlinkInterpreter," + "org.apache.zeppelin.python.PythonInterpreter,"