mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
- Removed TajoInterpreter from master
- Added example for using Tajo through JDBC
This commit is contained in:
parent
43baa0af49
commit
dbdd90e569
18 changed files with 32 additions and 3456 deletions
|
|
@ -110,7 +110,6 @@ The top-level pom.xml describes the basic project structure. Currently Zeppelin
|
|||
<module>angular</module>
|
||||
<module>shell</module>
|
||||
<module>hive</module>
|
||||
<module>tajo</module>
|
||||
<module>flink</module>
|
||||
<module>ignite</module>
|
||||
<module>lens</module>
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@
|
|||
|
||||
<property>
|
||||
<name>zeppelin.interpreters</name>
|
||||
<value>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.tajo.TajoInterpreter,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</value>
|
||||
<value>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</value>
|
||||
<description>Comma separated interpreter configurations. First interpreter become a default</description>
|
||||
</property>
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@
|
|||
<li><a href="{{BASE_PATH}}/interpreter/scalding.html">Scalding</a></li>
|
||||
<li><a href="{{BASE_PATH}}/pleasecontribute.html">Shell</a></li>
|
||||
<li><a href="{{BASE_PATH}}/interpreter/spark.html">Spark</a></li>
|
||||
<li><a href="{{BASE_PATH}}/pleasecontribute.html">Tajo</a></li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li><a href="{{BASE_PATH}}/manual/dynamicinterpreterload.html">Dynamic Interpreter Loading</a></li>
|
||||
<li><a href="{{BASE_PATH}}/manual/dependencymanagement.html">Interpreter Dependency Management</a></li>
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ bin/zeppelin-daemon.sh stop
|
|||
```
|
||||
|
||||
## Interpreter
|
||||
Zeppelin provides various distributed processing frameworks to process data that ranges from Spark, JDBC, Tajo, Ignite and Lens to name a few. This document describes to configure JDBC & Spark interpreters.
|
||||
Zeppelin provides various distributed processing frameworks to process data that ranges from Spark, JDBC, Ignite and Lens to name a few. This document describes to configure JDBC & Spark interpreters.
|
||||
|
||||
### Hive
|
||||
Zeppelin supports Hive through JDBC interpreter. You might need the information to use Hive and can find in your hive-site.xml
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ This interpreter lets you create a JDBC connection to any data source, by now it
|
|||
* Hive
|
||||
* Apache Drill
|
||||
* Details on using [Drill JDBC Driver](https://drill.apache.org/docs/using-the-jdbc-driver)
|
||||
* Apache Tajo
|
||||
|
||||
If someone else used another database please report how it works to improve functionality.
|
||||
|
||||
|
|
@ -235,7 +236,34 @@ To develop this functionality use this [method](http://docs.oracle.com/javase/7/
|
|||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
#### Tajo
|
||||
##### Properties
|
||||
<table class="table-configuration">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tajo.driver</td>
|
||||
<td>org.apache.tajo.jdbc.TajoDriver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tajo.url</td>
|
||||
<td>jdbc:tajo://localhost:26002/default</td>
|
||||
</tr>
|
||||
</table>
|
||||
##### Dependencies
|
||||
<table class="table-configuration">
|
||||
<tr>
|
||||
<th>Artifact</th>
|
||||
<th>Excludes</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<tdorg.apache.tajo:tajo-jdbc:0.11.0</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### How to use
|
||||
|
||||
#### Reference in paragraph
|
||||
|
|
|
|||
|
|
@ -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.hive.HiveInterpreter,org.apache.zeppelin.tajo.TajoInterpreter,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.hive.HiveInterpreter,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.ssl": "false",
|
||||
"zeppelin.notebook.autoInterpreterBinding": "true",
|
||||
"zeppelin.notebook.homescreen": "",
|
||||
|
|
|
|||
1
pom.xml
1
pom.xml
|
|
@ -76,7 +76,6 @@
|
|||
<module>phoenix</module>
|
||||
<module>postgresql</module>
|
||||
<module>jdbc</module>
|
||||
<module>tajo</module>
|
||||
<module>file</module>
|
||||
<module>flink</module>
|
||||
<module>ignite</module>
|
||||
|
|
|
|||
139
tajo/pom.xml
139
tajo/pom.xml
|
|
@ -1,139 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.6.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-tajo</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.6.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Tajo interpreter</name>
|
||||
<url>http://www.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<tajo.version>0.11.0</tajo.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-interpreter</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tajo</groupId>
|
||||
<artifactId>tajo-jdbc</artifactId>
|
||||
<version>${tajo.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/../../interpreter/tajo</outputDirectory>
|
||||
<overWriteReleases>false</overWriteReleases>
|
||||
<overWriteSnapshots>false</overWriteSnapshots>
|
||||
<overWriteIfNewer>true</overWriteIfNewer>
|
||||
<includeScope>runtime</includeScope>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-artifact</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/../../interpreter/tajo</outputDirectory>
|
||||
<overWriteReleases>false</overWriteReleases>
|
||||
<overWriteSnapshots>false</overWriteSnapshots>
|
||||
<overWriteIfNewer>true</overWriteIfNewer>
|
||||
<includeScope>runtime</includeScope>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>${project.packaging}</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
@ -1,200 +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.tajo;
|
||||
|
||||
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.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Tajo interpreter for Zeppelin.
|
||||
*/
|
||||
public class TajoInterpreter extends Interpreter {
|
||||
private Logger logger = LoggerFactory.getLogger(TajoInterpreter.class);
|
||||
|
||||
private Connection connection;
|
||||
private Statement statement;
|
||||
private Exception exceptionOnConnect;
|
||||
|
||||
public static final String TAJO_JDBC_URI = "tajo.jdbc.uri";
|
||||
public static final String TAJO_DRIVER_NAME = "org.apache.tajo.jdbc.TajoDriver";
|
||||
|
||||
static {
|
||||
Interpreter.register(
|
||||
"tql",
|
||||
"tajo",
|
||||
TajoInterpreter.class.getName(),
|
||||
new InterpreterPropertyBuilder()
|
||||
.add(TAJO_JDBC_URI, "jdbc:tajo://localhost:26002/default", "The URL for TajoServer.")
|
||||
.build());
|
||||
}
|
||||
|
||||
public TajoInterpreter(Properties property) {
|
||||
super(property);
|
||||
}
|
||||
|
||||
public Connection getJdbcConnection() throws SQLException {
|
||||
return DriverManager.getConnection(getProperty(TAJO_JDBC_URI));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
logger.info("Jdbc open connection called!");
|
||||
try {
|
||||
Class.forName(TAJO_DRIVER_NAME);
|
||||
} catch (ClassNotFoundException e) {
|
||||
logger.error("Can not open connection", e);
|
||||
exceptionOnConnect = e;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
connection = getJdbcConnection();
|
||||
exceptionOnConnect = null;
|
||||
logger.info("Successfully created connection");
|
||||
}
|
||||
catch (SQLException e) {
|
||||
logger.error("Cannot open connection", e);
|
||||
exceptionOnConnect = e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
logger.error("Cannot close connection", e);
|
||||
}
|
||||
finally {
|
||||
connection = null;
|
||||
exceptionOnConnect = null;
|
||||
}
|
||||
}
|
||||
|
||||
private InterpreterResult executeSql(String sql) {
|
||||
try {
|
||||
if (exceptionOnConnect != null) {
|
||||
return new InterpreterResult(Code.ERROR, exceptionOnConnect.getMessage());
|
||||
}
|
||||
statement = connection.createStatement();
|
||||
StringBuilder msg = null;
|
||||
if (StringUtils.containsIgnoreCase(sql, "EXPLAIN ")) {
|
||||
//return the explain as text, make this visual explain later
|
||||
msg = new StringBuilder();
|
||||
}
|
||||
else {
|
||||
msg = new StringBuilder("%table ");
|
||||
}
|
||||
|
||||
ResultSet res = statement.executeQuery(sql);
|
||||
try {
|
||||
ResultSetMetaData md = res.getMetaData();
|
||||
for (int i = 1; i < md.getColumnCount() + 1; i++) {
|
||||
if (i == 1) {
|
||||
msg.append(md.getColumnName(i));
|
||||
} else {
|
||||
msg.append("\t" + md.getColumnName(i));
|
||||
}
|
||||
}
|
||||
msg.append("\n");
|
||||
while (res.next()) {
|
||||
for (int i = 1; i < md.getColumnCount() + 1; i++) {
|
||||
msg.append(res.getString(i) + "\t");
|
||||
}
|
||||
msg.append("\n");
|
||||
}
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
res.close();
|
||||
statement.close();
|
||||
}
|
||||
finally {
|
||||
statement = null;
|
||||
}
|
||||
}
|
||||
|
||||
InterpreterResult interpreterResult = new InterpreterResult(Code.SUCCESS, msg.toString());
|
||||
return interpreterResult;
|
||||
}
|
||||
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 (statement != null) {
|
||||
try {
|
||||
statement.cancel();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
}
|
||||
finally {
|
||||
statement = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormType getFormType() {
|
||||
return FormType.SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProgress(InterpreterContext context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Scheduler getScheduler() {
|
||||
return SchedulerFactory.singleton().createOrGetFIFOScheduler(
|
||||
TajoInterpreter.class.getName() + this.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +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.tajo;
|
||||
|
||||
import org.apache.tajo.jdbc.TajoDriver;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tajo interpreter unit tests
|
||||
*/
|
||||
public class TajoInterpreterTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTajoInterpreter() throws Exception {
|
||||
TajoInterpreter t = new TesterTajoInterpreter(new Properties());
|
||||
t.open();
|
||||
|
||||
// check tajo jdbc driver
|
||||
Class clazz = Class.forName(t.TAJO_DRIVER_NAME);
|
||||
assertNotNull(clazz);
|
||||
|
||||
Constructor cons = clazz.getConstructor(new Class[]{});
|
||||
|
||||
TajoDriver driver = (TajoDriver) cons.newInstance();
|
||||
assertTrue(driver.acceptsURL("jdbc:tajo:"));
|
||||
assertFalse(driver.acceptsURL("jdbc:taju:"));
|
||||
|
||||
// simple select test
|
||||
InterpreterResult result = t.interpret("select * from t", null);
|
||||
assertEquals(result.type(), InterpreterResult.Type.TABLE);
|
||||
|
||||
// explain test
|
||||
result = t.interpret("explain select * from t", null);
|
||||
assertEquals(result.type(), InterpreterResult.Type.TEXT);
|
||||
|
||||
t.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,379 +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.tajo;
|
||||
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* This is borrowed from Apache Commons DBCP2.
|
||||
*
|
||||
* A dummy {@link java.sql.Connection}, for testing purposes.
|
||||
*/
|
||||
public class TesterConnection implements Connection {
|
||||
protected boolean _open = true;
|
||||
protected boolean _autoCommit = true;
|
||||
protected int _transactionIsolation = 1;
|
||||
protected DatabaseMetaData _metaData = new TesterDatabaseMetaData();
|
||||
protected String _catalog = null;
|
||||
protected Map<String,Class<?>> _typeMap = null;
|
||||
protected boolean _readOnly = false;
|
||||
protected SQLWarning warnings = null;
|
||||
protected String username = null;
|
||||
protected Exception failure;
|
||||
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
public void setWarnings(SQLWarning warning) {
|
||||
this.warnings = warning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearWarnings() throws SQLException {
|
||||
checkOpen();
|
||||
warnings = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SQLException {
|
||||
checkFailure();
|
||||
_open = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() throws SQLException {
|
||||
checkOpen();
|
||||
if (isReadOnly()) {
|
||||
throw new SQLException("Cannot commit a readonly connection");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement createStatement() throws SQLException {
|
||||
checkOpen();
|
||||
return new TesterStatement(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
|
||||
checkOpen();
|
||||
return new TesterStatement(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAutoCommit() throws SQLException {
|
||||
checkOpen();
|
||||
return _autoCommit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCatalog() throws SQLException {
|
||||
checkOpen();
|
||||
return _catalog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseMetaData getMetaData() throws SQLException {
|
||||
checkOpen();
|
||||
return _metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransactionIsolation() throws SQLException {
|
||||
checkOpen();
|
||||
return _transactionIsolation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Class<?>> getTypeMap() throws SQLException {
|
||||
checkOpen();
|
||||
return _typeMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SQLWarning getWarnings() throws SQLException {
|
||||
checkOpen();
|
||||
return warnings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClosed() throws SQLException {
|
||||
checkFailure();
|
||||
return !_open;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadOnly() throws SQLException {
|
||||
checkOpen();
|
||||
return _readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String nativeSQL(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
return sql;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableStatement prepareCall(String sql) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback() throws SQLException {
|
||||
checkOpen();
|
||||
if (isReadOnly()) {
|
||||
throw new SQLException("Cannot rollback a readonly connection");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoCommit(boolean autoCommit) throws SQLException {
|
||||
checkOpen();
|
||||
_autoCommit = autoCommit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCatalog(String catalog) throws SQLException {
|
||||
checkOpen();
|
||||
_catalog = catalog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadOnly(boolean readOnly) throws SQLException {
|
||||
checkOpen();
|
||||
_readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransactionIsolation(int level) throws SQLException {
|
||||
checkOpen();
|
||||
_transactionIsolation = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeMap(Map<String,Class<?>> map) throws SQLException {
|
||||
checkOpen();
|
||||
_typeMap = map;
|
||||
}
|
||||
|
||||
protected void checkOpen() throws SQLException {
|
||||
if(!_open) {
|
||||
throw new SQLException("Connection is closed.");
|
||||
}
|
||||
checkFailure();
|
||||
}
|
||||
|
||||
protected void checkFailure() throws SQLException {
|
||||
if (failure != null) {
|
||||
if(failure instanceof SQLException) {
|
||||
throw (SQLException)failure;
|
||||
} else {
|
||||
throw new SQLException("TesterConnection failure", failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setFailure(Exception failure) {
|
||||
this.failure = failure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHoldability() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHoldability(int holdability) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.sql.Savepoint setSavepoint() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.sql.Savepoint setSavepoint(String name) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback(java.sql.Savepoint savepoint) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseSavepoint(java.sql.Savepoint savepoint) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement createStatement(int resultSetType,
|
||||
int resultSetConcurrency,
|
||||
int resultSetHoldability)
|
||||
throws SQLException {
|
||||
return createStatement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int resultSetType,
|
||||
int resultSetConcurrency,
|
||||
int resultSetHoldability)
|
||||
throws SQLException {
|
||||
return prepareStatement(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableStatement prepareCall(String sql, int resultSetType,
|
||||
int resultSetConcurrency,
|
||||
int resultSetHoldability)
|
||||
throws SQLException {
|
||||
return prepareCall(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
|
||||
throws SQLException {
|
||||
return prepareStatement(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int columnIndexes[])
|
||||
throws SQLException {
|
||||
return prepareStatement(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, String columnNames[])
|
||||
throws SQLException {
|
||||
return prepareStatement(sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Blob createBlob() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clob createClob() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NClob createNClob() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SQLXML createSQLXML() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(int timeout) throws SQLException {
|
||||
return _open;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClientInfo(String name, String value) throws SQLClientInfoException {
|
||||
throw new SQLClientInfoException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClientInfo(Properties properties) throws SQLClientInfoException {
|
||||
throw new SQLClientInfoException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Properties getClientInfo() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClientInfo(String name) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSchema(String schema) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchema() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abort(Executor executor) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetworkTimeout(Executor executor, int milliseconds)
|
||||
throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNetworkTimeout() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,950 +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.tajo;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.RowIdLifetime;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* This is borrowed from Apache Commons DBCP2.
|
||||
*
|
||||
* Dummy {@link DatabaseMetaData} for testing purposes. Implements only those
|
||||
* methods required by the test cases.
|
||||
*/
|
||||
public class TesterDatabaseMetaData implements DatabaseMetaData {
|
||||
|
||||
@Override
|
||||
public boolean allProceduresAreCallable() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allTablesAreSelectable() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletesAreDetected(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getAttributes(String catalog, String schemaPattern,
|
||||
String typeNamePattern, String attributeNamePattern)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getBestRowIdentifier(String catalog, String schema,
|
||||
String table, int scope, boolean nullable) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCatalogSeparator() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCatalogTerm() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getCatalogs() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getColumnPrivileges(String catalog, String schema,
|
||||
String table, String columnNamePattern) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getColumns(String catalog, String schemaPattern,
|
||||
String tableNamePattern, String columnNamePattern)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getCrossReference(String parentCatalog,
|
||||
String parentSchema, String parentTable, String foreignCatalog,
|
||||
String foreignSchema, String foreignTable) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDatabaseMajorVersion() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDatabaseMinorVersion() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDatabaseProductName() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDatabaseProductVersion() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultTransactionIsolation() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDriverMajorVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDriverMinorVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverVersion() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getExportedKeys(String catalog, String schema, String table)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExtraNameCharacters() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifierQuoteString() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getImportedKeys(String catalog, String schema, String table)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getIndexInfo(String catalog, String schema, String table,
|
||||
boolean unique, boolean approximate) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJDBCMajorVersion() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJDBCMinorVersion() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxBinaryLiteralLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCatalogNameLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCharLiteralLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxColumnNameLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxColumnsInGroupBy() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxColumnsInIndex() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxColumnsInOrderBy() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxColumnsInSelect() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxColumnsInTable() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxConnections() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCursorNameLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxIndexLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxProcedureNameLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxRowSize() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSchemaNameLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxStatementLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxStatements() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTableNameLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTablesInSelect() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxUserNameLength() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNumericFunctions() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getPrimaryKeys(String catalog, String schema, String table)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getProcedureColumns(String catalog, String schemaPattern,
|
||||
String procedureNamePattern, String columnNamePattern)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProcedureTerm() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getProcedures(String catalog, String schemaPattern,
|
||||
String procedureNamePattern) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResultSetHoldability() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLKeywords() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSQLStateType() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchemaTerm() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getSchemas() throws SQLException {
|
||||
return new TesterResultSet(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSearchStringEscape() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringFunctions() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getSuperTables(String catalog, String schemaPattern,
|
||||
String tableNamePattern) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getSuperTypes(String catalog, String schemaPattern,
|
||||
String typeNamePattern) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSystemFunctions() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getTablePrivileges(String catalog, String schemaPattern,
|
||||
String tableNamePattern) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getTableTypes() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getTables(String catalog, String schemaPattern,
|
||||
String tableNamePattern, String[] types) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTimeDateFunctions() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getTypeInfo() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getUDTs(String catalog, String schemaPattern,
|
||||
String typeNamePattern, int[] types) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURL() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserName() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getVersionColumns(String catalog, String schema,
|
||||
String table) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertsAreDetected(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCatalogAtStart() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadOnly() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean locatorsUpdateCopy() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nullPlusNonNullIsNull() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nullsAreSortedAtEnd() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nullsAreSortedAtStart() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nullsAreSortedHigh() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nullsAreSortedLow() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean othersDeletesAreVisible(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean othersInsertsAreVisible(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean othersUpdatesAreVisible(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ownDeletesAreVisible(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ownInsertsAreVisible(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ownUpdatesAreVisible(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storesLowerCaseIdentifiers() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storesMixedCaseIdentifiers() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storesUpperCaseIdentifiers() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsANSI92EntryLevelSQL() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsANSI92FullSQL() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsANSI92IntermediateSQL() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsAlterTableWithAddColumn() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsAlterTableWithDropColumn() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsBatchUpdates() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCatalogsInDataManipulation() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCatalogsInProcedureCalls() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCatalogsInTableDefinitions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsColumnAliasing() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsConvert() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsConvert(int fromType, int toType)
|
||||
throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCoreSQLGrammar() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCorrelatedSubqueries() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsDataDefinitionAndDataManipulationTransactions()
|
||||
throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsDataManipulationTransactionsOnly()
|
||||
throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsDifferentTableCorrelationNames() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsExpressionsInOrderBy() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsExtendedSQLGrammar() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsFullOuterJoins() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsGetGeneratedKeys() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsGroupBy() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsGroupByBeyondSelect() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsGroupByUnrelated() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsIntegrityEnhancementFacility() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsLikeEscapeClause() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsLimitedOuterJoins() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsMinimumSQLGrammar() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsMixedCaseIdentifiers() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsMultipleOpenResults() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsMultipleResultSets() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsMultipleTransactions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsNamedParameters() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsNonNullableColumns() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsOrderByUnrelated() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsOuterJoins() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPositionedDelete() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPositionedUpdate() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsResultSetConcurrency(int type, int concurrency)
|
||||
throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsResultSetHoldability(int holdability)
|
||||
throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsResultSetType(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSavepoints() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSchemasInDataManipulation() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSchemasInIndexDefinitions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSchemasInProcedureCalls() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSchemasInTableDefinitions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSelectForUpdate() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsStatementPooling() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsStoredProcedures() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSubqueriesInComparisons() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSubqueriesInExists() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSubqueriesInIns() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSubqueriesInQuantifieds() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsTableCorrelationNames() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsTransactionIsolationLevel(int level)
|
||||
throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsTransactions() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUnion() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUnionAll() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatesAreDetected(int type) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesLocalFilePerTable() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesLocalFiles() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* JDBC_4_ANT_KEY_BEGIN */
|
||||
|
||||
@Override
|
||||
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RowIdLifetime getRowIdLifetime() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getSchemas(String catalog, String schemaPattern)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getClientInfoProperties() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getFunctionColumns(String catalog, String schemaPattern,
|
||||
String functionNamePattern, String columnNamePattern)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getFunctions(String catalog, String schemaPattern,
|
||||
String functionNamePattern) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JDBC_4_ANT_KEY_END */
|
||||
|
||||
@Override
|
||||
public ResultSet getPseudoColumns(String catalog, String schemaPattern,
|
||||
String tableNamePattern, String columnNamePattern)
|
||||
throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generatedKeyAlwaysReturned() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,157 +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.tajo;
|
||||
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A dummy {@link java.sql.ResultSetMetaData}, for testing purposes.
|
||||
*/
|
||||
public class TesterResultSetMetaData implements ResultSetMetaData {
|
||||
|
||||
// Dummy columns
|
||||
private List<String> columns = null;
|
||||
|
||||
public TesterResultSetMetaData() {
|
||||
columns = new ArrayList<String>();
|
||||
columns.add("id");
|
||||
columns.add("name");
|
||||
columns.add("score");
|
||||
columns.add("type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() throws SQLException {
|
||||
return columns.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoIncrement(int column) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCaseSensitive(int column) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSearchable(int column) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCurrency(int column) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isNullable(int column) throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSigned(int column) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnDisplaySize(int column) throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnLabel(int column) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column) throws SQLException {
|
||||
return columns.get(column - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchemaName(int column) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPrecision(int column) throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScale(int column) throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName(int column) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCatalogName(int column) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnType(int column) throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnTypeName(int column) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadOnly(int column) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWritable(int column) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefinitelyWritable(int column) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnClassName(int column) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,344 +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.tajo;
|
||||
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
/**
|
||||
* This is borrowed from Apache Commons DBCP2.
|
||||
*
|
||||
* A dummy {@link java.sql.Statement}, for testing purposes.
|
||||
*/
|
||||
public class TesterStatement implements Statement {
|
||||
public TesterStatement(Connection conn) {
|
||||
_connection = conn;
|
||||
}
|
||||
|
||||
public TesterStatement(Connection conn, int resultSetType, int resultSetConcurrency) {
|
||||
_connection = conn;
|
||||
_resultSetType = resultSetType;
|
||||
_resultSetConcurrency = resultSetConcurrency;
|
||||
}
|
||||
|
||||
protected Connection _connection = null;
|
||||
protected boolean _open = true;
|
||||
protected int _rowsUpdated = 1;
|
||||
protected boolean _executeResponse = true;
|
||||
protected int _maxFieldSize = 1024;
|
||||
protected int _maxRows = 1024;
|
||||
protected boolean _escapeProcessing = false;
|
||||
protected int _queryTimeout = 1000;
|
||||
protected String _cursorName = null;
|
||||
protected int _fetchDirection = 1;
|
||||
protected int _fetchSize = 1;
|
||||
protected int _resultSetConcurrency = 1;
|
||||
protected int _resultSetType = 1;
|
||||
protected ResultSet _resultSet = null;
|
||||
|
||||
@Override
|
||||
public ResultSet executeQuery(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
if("null".equals(sql)) {
|
||||
return null;
|
||||
}
|
||||
if("invalid".equals(sql)) {
|
||||
throw new SQLException("invalid query");
|
||||
}
|
||||
if ("broken".equals(sql)) {
|
||||
throw new SQLException("broken connection");
|
||||
}
|
||||
if("select username".equals(sql)) {
|
||||
String username = ((TesterConnection) _connection).getUsername();
|
||||
Object[][] data = {{username}};
|
||||
return new TesterResultSet(this, data);
|
||||
} else {
|
||||
// Simulate timeout if queryTimout is set to less than 5 seconds
|
||||
if (_queryTimeout > 0 && _queryTimeout < 5) {
|
||||
throw new SQLException("query timeout");
|
||||
}
|
||||
return new TesterResultSet(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdate(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
return _rowsUpdated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SQLException {
|
||||
// calling close twice has no effect
|
||||
if (!_open) {
|
||||
return;
|
||||
}
|
||||
|
||||
_open = false;
|
||||
if (_resultSet != null) {
|
||||
_resultSet.close();
|
||||
_resultSet = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFieldSize() throws SQLException {
|
||||
checkOpen();
|
||||
return _maxFieldSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxFieldSize(int max) throws SQLException {
|
||||
checkOpen();
|
||||
_maxFieldSize = max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxRows() throws SQLException {
|
||||
checkOpen();
|
||||
return _maxRows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxRows(int max) throws SQLException {
|
||||
checkOpen();
|
||||
_maxRows = max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEscapeProcessing(boolean enable) throws SQLException {
|
||||
checkOpen();
|
||||
_escapeProcessing = enable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getQueryTimeout() throws SQLException {
|
||||
checkOpen();
|
||||
return _queryTimeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQueryTimeout(int seconds) throws SQLException {
|
||||
checkOpen();
|
||||
_queryTimeout = seconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() throws SQLException {
|
||||
checkOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SQLWarning getWarnings() throws SQLException {
|
||||
checkOpen();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearWarnings() throws SQLException {
|
||||
checkOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorName(String name) throws SQLException {
|
||||
checkOpen();
|
||||
_cursorName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
if("invalid".equals(sql)) {
|
||||
throw new SQLException("invalid query");
|
||||
}
|
||||
return _executeResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getResultSet() throws SQLException {
|
||||
checkOpen();
|
||||
if (_resultSet == null) {
|
||||
_resultSet = new TesterResultSet(this);
|
||||
}
|
||||
return _resultSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpdateCount() throws SQLException {
|
||||
checkOpen();
|
||||
return _rowsUpdated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getMoreResults() throws SQLException {
|
||||
checkOpen();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFetchDirection(int direction) throws SQLException {
|
||||
checkOpen();
|
||||
_fetchDirection = direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFetchDirection() throws SQLException {
|
||||
checkOpen();
|
||||
return _fetchDirection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFetchSize(int rows) throws SQLException {
|
||||
checkOpen();
|
||||
_fetchSize = rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFetchSize() throws SQLException {
|
||||
checkOpen();
|
||||
return _fetchSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResultSetConcurrency() throws SQLException {
|
||||
checkOpen();
|
||||
return _resultSetConcurrency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResultSetType() throws SQLException {
|
||||
checkOpen();
|
||||
return _resultSetType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBatch(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBatch() throws SQLException {
|
||||
checkOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] executeBatch() throws SQLException {
|
||||
checkOpen();
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
checkOpen();
|
||||
return _connection;
|
||||
}
|
||||
|
||||
protected void checkOpen() throws SQLException {
|
||||
if(!_open) {
|
||||
throw new SQLException("Connection is closed.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getMoreResults(int current) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getGeneratedKeys() throws SQLException {
|
||||
return new TesterResultSet(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdate(String sql, int autoGeneratedKeys)
|
||||
throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdate(String sql, int columnIndexes[])
|
||||
throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdate(String sql, String columnNames[])
|
||||
throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(String sql, int autoGeneratedKeys)
|
||||
throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(String sql, int columnIndexes[])
|
||||
throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(String sql, String columnNames[])
|
||||
throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResultSetHoldability() throws SQLException {
|
||||
checkOpen();
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClosed() throws SQLException {
|
||||
return !_open;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoolable(boolean poolable) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPoolable() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeOnCompletion() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCloseOnCompletion() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not implemented.");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +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.tajo;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
|
||||
public class TesterTajoInterpreter extends TajoInterpreter {
|
||||
|
||||
public TesterTajoInterpreter(Properties property) {
|
||||
super(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getJdbcConnection()
|
||||
throws SQLException {
|
||||
return new TesterConnection();
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +42,6 @@ The following components are provided under Apache License.
|
|||
(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 Tajo (http://tajo.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/)
|
||||
|
|
|
|||
|
|
@ -492,7 +492,6 @@ public class ZeppelinConfiguration extends XMLConfiguration {
|
|||
+ "org.apache.zeppelin.file.HDFSFileInterpreter,"
|
||||
+ "org.apache.zeppelin.phoenix.PhoenixInterpreter,"
|
||||
+ "org.apache.zeppelin.postgresql.PostgreSqlInterpreter,"
|
||||
+ "org.apache.zeppelin.tajo.TajoInterpreter,"
|
||||
+ "org.apache.zeppelin.flink.FlinkInterpreter,"
|
||||
+ "org.apache.zeppelin.python.PythonInterpreter,"
|
||||
+ "org.apache.zeppelin.ignite.IgniteInterpreter,"
|
||||
|
|
|
|||
Loading…
Reference in a new issue