mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Merge branch 'master' into ZEPPELIN-732-up
This commit is contained in:
commit
14efb6cde6
64 changed files with 734 additions and 3543 deletions
|
|
@ -20,6 +20,7 @@ sudo: false
|
|||
cache:
|
||||
directories:
|
||||
- .spark-dist
|
||||
- ${HOME}/.m2/repository/.cache/maven-download-plugin
|
||||
|
||||
addons:
|
||||
apt:
|
||||
|
|
@ -61,7 +62,7 @@ matrix:
|
|||
env: TEST_SELENIUM="true" SPARK_VER="1.6.1" HADOOP_VER="2.3" PROFILE="-Pspark-1.6 -Phadoop-2.3 -Ppyspark -Pexamples" BUILD_FLAG="package -DskipTests" TEST_FLAG="verify" TEST_PROJECTS="-pl zeppelin-interpreter,zeppelin-zengine,zeppelin-server,zeppelin-display,spark-dependencies,spark -Dtest=org.apache.zeppelin.AbstractFunctionalSuite -DfailIfNoTests=false"
|
||||
|
||||
before_install:
|
||||
- "ls -la .spark-dist"
|
||||
- "ls -la .spark-dist ${HOME}/.m2/repository/.cache/maven-download-plugin"
|
||||
- mkdir -p ~/R
|
||||
- echo 'R_LIBS=~/R' > ~/.Renviron
|
||||
- R -e "install.packages('knitr', repos = 'http://cran.us.r-project.org', lib='~/R')"
|
||||
|
|
@ -95,4 +96,3 @@ after_failure:
|
|||
|
||||
after_script:
|
||||
- ./testing/stopSparkCluster.sh $SPARK_VER $HADOOP_VER
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
10
LICENSE
10
LICENSE
|
|
@ -256,4 +256,12 @@ The following components are provided under the BSD 3-Clause license. See file
|
|||
r/src/main/scala/org/apache/zeppelin/rinterpreter/rscala/{Package.scala, RClient.scala}
|
||||
|
||||
(BSD 3 Clause) portions of Scala (http://www.scala-lang.org/download) - http://www.scala-lang.org/download/#License
|
||||
r/src/main/scala/scala/Console.scala
|
||||
r/src/main/scala/scala/Console.scala
|
||||
|
||||
========================================================================
|
||||
BSD 2-Clause licenses
|
||||
========================================================================
|
||||
The following components are provided under the BSD 3-Clause license. See file headers and project links for details.
|
||||
|
||||
(BSD 2 Clause) portions of SQLLine (http://sqlline.sourceforge.net/) - http://sqlline.sourceforge.net/#license
|
||||
jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
|
||||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,6 @@ See https://help.github.com/articles/using-jekyll-with-pages#installing-jekyll
|
|||
## Bumping up version in a new release
|
||||
|
||||
* `ZEPPELIN_VERSION` and `BASE_PATH` property in _config.yml
|
||||
* `Zeppelin <small>([VERSION])</small>` in _includes/themes/zeppelin/_navigation.html
|
||||
should be updated
|
||||
|
||||
|
||||
## Deploy to ASF svnpubsub infra (for committers only)
|
||||
1. generate static website in `./_site`
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<a class="navbar-brand" href="{{BASE_PATH}}">
|
||||
<img src="/assets/themes/zeppelin/img/zeppelin_logo.png" width="50" alt="I'm zeppelin">
|
||||
<span style="vertical-align:middle">Zeppelin</span>
|
||||
<span style="vertical-align:baseline"><small>(0.6.0-SNAPSHOT)</small></span>
|
||||
<span style="vertical-align:baseline"><small>{{site.ZEPPELIN_VERSION}}</small></span>
|
||||
</a>
|
||||
</div>
|
||||
<nav class="navbar-collapse collapse" role="navigation">
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
|
||||
<script src="{{ ASSET_PATH }}/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="{{ ASSET_PATH }}/js/docs.js"></script>
|
||||
<script src="{{ ASSET_PATH }}/js/anchor.min.js"></script>
|
||||
|
||||
<!-- atom & rss feed -->
|
||||
<link href="{{ BASE_PATH }}{{ site.JB.atom_path }}" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed">
|
||||
|
|
|
|||
|
|
@ -501,8 +501,9 @@ a.anchor {
|
|||
|
||||
.navbar-brand small {
|
||||
font-size: 14px;
|
||||
font-family: 'Helvetica Neue', Helvetica;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica;
|
||||
color: white;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.navbar-collapse.collapse {
|
||||
|
|
@ -523,6 +524,8 @@ a.anchor {
|
|||
background: #286090;
|
||||
}
|
||||
|
||||
a.anchorjs-link:hover { text-decoration: none; }
|
||||
|
||||
/* Custom, iPhone Retina */
|
||||
@media only screen and (max-width: 480px) {
|
||||
.jumbotron h1 {
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
6
docs/assets/themes/zeppelin/js/anchor.min.js
vendored
Executable file
6
docs/assets/themes/zeppelin/js/anchor.min.js
vendored
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
/*!
|
||||
* AnchorJS - v1.1.1 - 2015-05-23
|
||||
* https://github.com/bryanbraun/anchorjs
|
||||
* Copyright (c) 2015 Bryan Braun; Licensed MIT
|
||||
*/
|
||||
function AnchorJS(A){"use strict";this.options=A||{},this._applyRemainingDefaultOptions=function(A){this.options.icon=this.options.hasOwnProperty("icon")?A.icon:"",this.options.visible=this.options.hasOwnProperty("visible")?A.visible:"hover",this.options.placement=this.options.hasOwnProperty("placement")?A.placement:"right",this.options.class=this.options.hasOwnProperty("class")?A.class:""},this._applyRemainingDefaultOptions(A),this.add=function(A){var e,t,o,n,i,s,a,l,c,r,h,g,B,Q;if(this._applyRemainingDefaultOptions(this.options),A){if("string"!=typeof A)throw new Error("The selector provided to AnchorJS was invalid.")}else A="h1, h2, h3, h4, h5, h6";if(e=document.querySelectorAll(A),0===e.length)return!1;for(this._addBaselineStyles(),t=document.querySelectorAll("[id]"),o=[].map.call(t,function(A){return A.id}),i=0;i<e.length;i++){if(e[i].hasAttribute("id"))n=e[i].getAttribute("id");else{s=e[i].textContent,a=s.replace(/[^\w\s-]/gi,"").replace(/\s+/g,"-").replace(/-{2,}/g,"-").substring(0,64).replace(/^-+|-+$/gm,"").toLowerCase(),r=a,c=0;do void 0!==l&&(r=a+"-"+c),l=o.indexOf(r),c+=1;while(-1!==l);l=void 0,o.push(r),e[i].setAttribute("id",r),n=r}h=n.replace(/-/g," "),g='<a class="anchorjs-link '+this.options.class+'" href="#'+n+'" aria-label="Anchor link for: '+h+'" data-anchorjs-icon="'+this.options.icon+'"></a>',B=document.createElement("div"),B.innerHTML=g,Q=B.childNodes,"always"===this.options.visible&&(Q[0].style.opacity="1"),""===this.options.icon&&(Q[0].style.fontFamily="anchorjs-icons",Q[0].style.fontStyle="normal",Q[0].style.fontVariant="normal",Q[0].style.fontWeight="normal"),"left"===this.options.placement?(Q[0].style.position="absolute",Q[0].style.marginLeft="-1em",Q[0].style.paddingRight="0.5em",e[i].insertBefore(Q[0],e[i].firstChild)):(Q[0].style.paddingLeft="0.375em",e[i].appendChild(Q[0]))}return this},this.remove=function(A){for(var e,t=document.querySelectorAll(A),o=0;o<t.length;o++)e=t[o].querySelector(".anchorjs-link"),e&&t[o].removeChild(e);return this},this._addBaselineStyles=function(){if(null===document.head.querySelector("style.anchorjs")){var A,e=document.createElement("style"),t=" .anchorjs-link { opacity: 0; text-decoration: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }",o=" *:hover > .anchorjs-link, .anchorjs-link:focus { opacity: 1; }",n=' @font-face { font-family: "anchorjs-icons"; font-style: normal; font-weight: normal; src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6cv//f//AAAAAAAg6cv//f//AAH/4xY5AAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACADEARAJTAsAAKwBUAAABIiYnJjQ/AT4BMzIWFxYUDwEGIicmND8BNjQnLgEjIgYPAQYUFxYUBw4BIwciJicmND8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFA8BDgEjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAEAAAABAACiToc1Xw889QALBAAAAAAA0XnFFgAAAADRecUWAAAAAAJTAsAAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAAlMAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAACAAAAAoAAMQAAAAAACgAUAB4AmgABAAAABQBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4YW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype"); }',i=" [data-anchorjs-icon]::after { content: attr(data-anchorjs-icon); }";e.className="anchorjs",e.appendChild(document.createTextNode("")),A=document.head.querySelector('[rel="stylesheet"], style'),void 0===A?document.head.appendChild(e):document.head.insertBefore(e,A),e.sheet.insertRule(t,e.sheet.cssRules.length),e.sheet.insertRule(o,e.sheet.cssRules.length),e.sheet.insertRule(i,e.sheet.cssRules.length),e.sheet.insertRule(n,e.sheet.cssRules.length)}}}var anchors=new AnchorJS;
|
||||
|
|
@ -107,7 +107,12 @@ function maybeScrollToHash() {
|
|||
|
||||
$(function() {
|
||||
codeTabs();
|
||||
viewSolution();
|
||||
// Display anchor links when hovering over headers. For documentation of the
|
||||
// configuration options, see the AnchorJS documentation.
|
||||
anchors.options = {
|
||||
placement: 'left'
|
||||
};
|
||||
anchors.add();
|
||||
|
||||
$(window).bind('hashchange', function() {
|
||||
maybeScrollToHash();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ curl -fsSL https://raw.githubusercontent.com/NFLabs/z-manager/master/zeppelin-in
|
|||
|
||||
### Building Zeppelin
|
||||
|
||||
You can now `git clone git://git.apache.org/incubator-zeppelin.git` into a directory on your host machine, or directly in your virtual machine.
|
||||
You can now `git clone git://git.apache.org/zeppelin.git` into a directory on your host machine, or directly in your virtual machine.
|
||||
|
||||
Cloning Zeppelin into the `/scripts/vagrant/zeppelin-dev` directory from the host, will allow the directory to be shared between your host and the guest machine.
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ Cloning the project again may seem counter intuitive, since this script likley o
|
|||
Synced folders enable Vagrant to sync a folder on the host machine to the guest machine, allowing you to continue working on your project's files on your host machine, but use the resources in the guest machine to compile or run your project. _[(1) Synced Folder Description from Vagrant Up](https://docs.vagrantup.com/v2/synced-folders/index.html)_
|
||||
|
||||
By default, Vagrant will share your project directory (the directory with the Vagrantfile) to `/vagrant`. Which means you should be able to build within the guest machine after you
|
||||
`cd /vagrant/incubator-zeppelin`
|
||||
`cd /vagrant/zeppelin`
|
||||
|
||||
|
||||
### What's in this VM?
|
||||
|
|
@ -101,7 +101,7 @@ The virtual machine consists of:
|
|||
This assumes you've already cloned the project either on the host machine in the zeppelin-dev directory (to be shared with the guest machine) or cloned directly into a directory while running inside the guest machine. The following build steps will also include Python and R support via PySpark and SparkR:
|
||||
|
||||
```
|
||||
cd /incubator-zeppelin
|
||||
cd /zeppelin
|
||||
mvn clean package -Pspark-1.6 -Ppyspark -Phadoop-2.4 -Psparkr -DskipTests
|
||||
./bin/zeppelin-daemon.sh start
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
<td>org.apache.tajo:tajo-jdbc:0.11.0</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### How to use
|
||||
|
||||
#### Reference in paragraph
|
||||
|
|
|
|||
|
|
@ -6,7 +6,49 @@ group: manual
|
|||
---
|
||||
{% include JB/setup %}
|
||||
|
||||
## Important Notice
|
||||
Postgresql Interpreter will be deprecated and merged into JDBC Interpreter. You can use Postgresql by using JDBC Interpreter with same functionality. See the example below of settings and dependencies.
|
||||
|
||||
### Properties
|
||||
<table class="table-configuration">
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>psql.driver</td>
|
||||
<td>org.postgresql.Driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>psql.url</td>
|
||||
<td>jdbc:postgresql://localhost:5432/</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>psql.user</td>
|
||||
<td>psqlUser</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>psql.password</td>
|
||||
<td>psqlPassword</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Dependencies
|
||||
<table class="table-configuration">
|
||||
<tr>
|
||||
<th>Artifact</th>
|
||||
<th>Exclude</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>org.postgresql:postgresql:9.4-1201-jdbc41</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
----
|
||||
|
||||
## PostgreSQL, HAWQ Interpreter for Apache Zeppelin
|
||||
|
||||
<table class="table-configuration">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
|
|
|
|||
|
|
@ -60,3 +60,19 @@ Each Interpreter Setting can choose one of 'shared', 'scoped', 'isolated' interp
|
|||
In 'shared' mode, every notebook bound to the Interpreter Setting will share the single Interpreter instance. In 'scoped' mode, each notebook will create new Interpreter instance in the same interpreter process. In 'isolated' mode, each notebook will create new Interpreter process.
|
||||
|
||||
<img src="../assets/themes/zeppelin/img/screenshots/interpreter_persession.png" width="400px">
|
||||
|
||||
|
||||
## Connecting to the Existing Remote Interpreter
|
||||
|
||||
Zeppelin users can start interpreter thread embedded in their service. This will provide flexibility to user to start interpreter on remote host. To start interpreter along with your service you have to create an instance of ``RemoteInterpreterServer`` and start it as follows:
|
||||
|
||||
```
|
||||
RemoteInterpreterServer interpreter=new RemoteInterpreterServer(3678);
|
||||
// Here, 3678 is the port on which interpreter will listen.
|
||||
interpreter.start()
|
||||
|
||||
```
|
||||
|
||||
The above code will start interpreter thread inside your process. Once the interpreter is started you can configure zeppelin to connect to RemoteInterpreter by checking **Connect to existing process** checkbox and then provide **Host** and **Port** on which interpreter porocess is listening as shown in the image below:
|
||||
|
||||
<img src="../assets/themes/zeppelin/img/screenshots/existing_interpreter.png" width="400px">
|
||||
|
|
|
|||
|
|
@ -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": "",
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ If someone who doesn't have **read** permission is trying to access the notebook
|
|||
In this section, we will explain the detail about how the notebook authorization works in backend side.
|
||||
|
||||
#### NotebookServer
|
||||
The [NotebookServer](https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java) classifies every notebook operations into three categories: **Read**, **Write**, **Manage**.
|
||||
The [NotebookServer](https://github.com/apache/zeppelin/blob/master/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java) classifies every notebook operations into three categories: **Read**, **Write**, **Manage**.
|
||||
Before executing a notebook operation, it checks if the user and the groups associated with the `NotebookSocket` have permissions.
|
||||
For example, before executing a **Read** operation, it checks if the user and the groups have at least one entity that belongs to the **Reader** entities.
|
||||
|
||||
#### Notebook REST API call
|
||||
Zeppelin executes a [REST API call](https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java) for the notebook permission information.
|
||||
Zeppelin executes a [REST API call](https://github.com/apache/zeppelin/blob/master/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java) for the notebook permission information.
|
||||
In the backend side, Zeppelin gets the user information for the connection and allows the operation if the users and groups
|
||||
associated with the current user have at least one entity that belongs to owner entities for the notebook.
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ import java.util.Set;
|
|||
|
||||
import org.apache.zeppelin.interpreter.Interpreter;
|
||||
import org.apache.zeppelin.interpreter.InterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.InterpreterException;
|
||||
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;
|
||||
|
|
@ -50,7 +48,7 @@ import com.google.common.collect.Sets.SetView;
|
|||
/**
|
||||
* JDBC interpreter for Zeppelin. This interpreter can also be used for accessing HAWQ,
|
||||
* GreenplumDB, MariaDB, MySQL, Postgres and Redshit.
|
||||
*
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code default.url} - JDBC URL to connect to.</li>
|
||||
* <li>{@code default.user} - JDBC user name..</li>
|
||||
|
|
@ -58,22 +56,21 @@ import com.google.common.collect.Sets.SetView;
|
|||
* <li>{@code default.driver.name} - JDBC driver name.</li>
|
||||
* <li>{@code common.max.result} - Max number of SQL result to display.</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* How to use: <br/>
|
||||
* {@code %jdbc.sql} <br/>
|
||||
* {@code
|
||||
* SELECT store_id, count(*)
|
||||
* FROM retail_demo.order_lineitems_pxf
|
||||
* GROUP BY store_id;
|
||||
* {@code
|
||||
* SELECT store_id, count(*)
|
||||
* FROM retail_demo.order_lineitems_pxf
|
||||
* GROUP BY store_id;
|
||||
* }
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public class JDBCInterpreter extends Interpreter {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(JDBCInterpreter.class);
|
||||
|
||||
|
||||
static final String COMMON_KEY = "common";
|
||||
static final String MAX_LINE_KEY = "max_count";
|
||||
static final String MAX_LINE_DEFAULT = "1000";
|
||||
|
|
@ -84,7 +81,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
static final String USER_KEY = "user";
|
||||
static final String PASSWORD_KEY = "password";
|
||||
static final String DOT = ".";
|
||||
|
||||
|
||||
private static final char WHITESPACE = ' ';
|
||||
private static final char NEWLINE = '\n';
|
||||
private static final char TAB = '\t';
|
||||
|
|
@ -100,21 +97,33 @@ public class JDBCInterpreter extends Interpreter {
|
|||
static final String DEFAULT_PASSWORD = DEFAULT_KEY + DOT + PASSWORD_KEY;
|
||||
|
||||
static final String EMPTY_COLUMN_VALUE = "";
|
||||
|
||||
|
||||
private final HashMap<String, Properties> propertiesMap;
|
||||
private final Map<String, Statement> paragraphIdStatementMap;
|
||||
|
||||
private final Map<String, ArrayList<Connection>> propertyKeyUnusedConnectionListMap;
|
||||
private final Map<String, Connection> paragraphIdConnectionMap;
|
||||
|
||||
private final Map<String, SqlCompleter> propertyKeySqlCompleterMap;
|
||||
|
||||
private static final Function<CharSequence, String> sequenceToStringTransformer =
|
||||
new Function<CharSequence, String>() {
|
||||
public String apply(CharSequence seq) {
|
||||
return seq.toString();
|
||||
}
|
||||
};
|
||||
|
||||
private static final List<String> NO_COMPLETION = new ArrayList<>();
|
||||
|
||||
public JDBCInterpreter(Properties property) {
|
||||
super(property);
|
||||
propertiesMap = new HashMap<>();
|
||||
propertyKeyUnusedConnectionListMap = new HashMap<>();
|
||||
paragraphIdStatementMap = new HashMap<>();
|
||||
paragraphIdConnectionMap = new HashMap<>();
|
||||
propertyKeySqlCompleterMap = new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String, Properties> getPropertiesMap() {
|
||||
return propertiesMap;
|
||||
}
|
||||
|
|
@ -154,9 +163,38 @@ public class JDBCInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
logger.debug("propertiesMap: {}", propertiesMap);
|
||||
|
||||
Connection connection = null;
|
||||
SqlCompleter sqlCompleter = null;
|
||||
for (String propertyKey : propertiesMap.keySet()) {
|
||||
try {
|
||||
connection = getConnection(propertyKey);
|
||||
sqlCompleter = createSqlCompleter(connection);
|
||||
} catch (Exception e) {
|
||||
sqlCompleter = createSqlCompleter(null);
|
||||
}
|
||||
propertyKeySqlCompleterMap.put(propertyKey, sqlCompleter);
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection(String propertyKey) throws ClassNotFoundException, SQLException {
|
||||
|
||||
private SqlCompleter createSqlCompleter(Connection jdbcConnection) {
|
||||
|
||||
SqlCompleter completer = null;
|
||||
try {
|
||||
Set<String> keywordsCompletions = SqlCompleter.getSqlKeywordsCompletions(jdbcConnection);
|
||||
Set<String> dataModelCompletions =
|
||||
SqlCompleter.getDataModelMetadataCompletions(jdbcConnection);
|
||||
SetView<String> allCompletions = Sets.union(keywordsCompletions, dataModelCompletions);
|
||||
completer = new SqlCompleter(allCompletions, dataModelCompletions);
|
||||
|
||||
} catch (IOException | SQLException e) {
|
||||
logger.error("Cannot create SQL completer", e);
|
||||
}
|
||||
|
||||
return completer;
|
||||
}
|
||||
|
||||
public Connection getConnection(String propertyKey) throws ClassNotFoundException, SQLException {
|
||||
Connection connection = null;
|
||||
if (propertyKey == null || propertiesMap.get(propertyKey) == null) {
|
||||
return null;
|
||||
|
|
@ -180,7 +218,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
public Statement getStatement(String propertyKey, String paragraphId)
|
||||
throws SQLException, ClassNotFoundException {
|
||||
Connection connection;
|
||||
|
|
@ -189,7 +227,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
} else {
|
||||
connection = getConnection(propertyKey);
|
||||
}
|
||||
|
||||
|
||||
if (connection == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -213,7 +251,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
|
|
@ -241,13 +279,13 @@ public class JDBCInterpreter extends Interpreter {
|
|||
|
||||
private InterpreterResult executeSql(String propertyKey, String sql,
|
||||
InterpreterContext interpreterContext) {
|
||||
|
||||
|
||||
String paragraphId = interpreterContext.getParagraphId();
|
||||
|
||||
try {
|
||||
|
||||
Statement statement = getStatement(propertyKey, paragraphId);
|
||||
|
||||
|
||||
if (statement == null) {
|
||||
return new InterpreterResult(Code.ERROR, "Prefix not found.");
|
||||
}
|
||||
|
|
@ -346,7 +384,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
if (null != propertyKey && !propertyKey.equals(DEFAULT_KEY)) {
|
||||
cmd = cmd.substring(propertyKey.length() + 2);
|
||||
}
|
||||
|
||||
|
||||
cmd = cmd.trim();
|
||||
|
||||
logger.info("PropertyKey: {}, SQL command: '{}'", propertyKey, cmd);
|
||||
|
|
@ -382,7 +420,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
return DEFAULT_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FormType getFormType() {
|
||||
return FormType.SIMPLE;
|
||||
|
|
@ -401,7 +439,13 @@ public class JDBCInterpreter extends Interpreter {
|
|||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
return null;
|
||||
List<CharSequence> candidates = new ArrayList<>();
|
||||
SqlCompleter sqlCompleter = propertyKeySqlCompleterMap.get(getPropertyKey(buf));
|
||||
if (sqlCompleter != null && sqlCompleter.complete(buf, cursor, candidates) >= 0) {
|
||||
return Lists.transform(candidates, sequenceToStringTransformer);
|
||||
} else {
|
||||
return NO_COMPLETION;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxResult() {
|
||||
|
|
|
|||
250
jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
Normal file
250
jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
/**
|
||||
* 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.jdbc;
|
||||
|
||||
/*
|
||||
* This source file is based on code taken from SQLLine 1.0.2 See SQLLine notice in LICENSE
|
||||
*/
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.Sets.SetView;
|
||||
import jline.console.completer.ArgumentCompleter.ArgumentList;
|
||||
import jline.console.completer.ArgumentCompleter.WhitespaceArgumentDelimiter;
|
||||
import jline.console.completer.StringsCompleter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.isBlank;
|
||||
|
||||
/**
|
||||
* SQL auto complete functionality for the JdbcInterpreter.
|
||||
*/
|
||||
public class SqlCompleter extends StringsCompleter {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(SqlCompleter.class);
|
||||
|
||||
/**
|
||||
* Delimiter that can split SQL statement in keyword list
|
||||
*/
|
||||
private WhitespaceArgumentDelimiter sqlDelimiter = new WhitespaceArgumentDelimiter() {
|
||||
|
||||
private Pattern pattern = Pattern.compile("[\\.:;,]");
|
||||
|
||||
@Override
|
||||
public boolean isDelimiterChar(CharSequence buffer, int pos) {
|
||||
return pattern.matcher("" + buffer.charAt(pos)).matches()
|
||||
|| super.isDelimiterChar(buffer, pos);
|
||||
}
|
||||
};
|
||||
|
||||
private Set<String> modelCompletions = new HashSet<>();
|
||||
|
||||
public SqlCompleter(Set<String> allCompletions, Set<String> dataModelCompletions) {
|
||||
super(allCompletions);
|
||||
this.modelCompletions = dataModelCompletions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int complete(String buffer, int cursor, List<CharSequence> candidates) {
|
||||
|
||||
if (isBlank(buffer) || (cursor > buffer.length() + 1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// The delimiter breaks the buffer into separate words (arguments), separated by the
|
||||
// white spaces.
|
||||
ArgumentList argumentList = sqlDelimiter.delimit(buffer, cursor);
|
||||
String argument = argumentList.getCursorArgument();
|
||||
// cursor in the selected argument
|
||||
int argumentPosition = argumentList.getArgumentPosition();
|
||||
|
||||
if (isBlank(argument)) {
|
||||
int argumentsCount = argumentList.getArguments().length;
|
||||
if (argumentsCount <= 0 || ((buffer.length() + 2) < cursor)
|
||||
|| sqlDelimiter.isDelimiterChar(buffer, cursor - 2)) {
|
||||
return -1;
|
||||
}
|
||||
argument = argumentList.getArguments()[argumentsCount - 1];
|
||||
argumentPosition = argument.length();
|
||||
}
|
||||
|
||||
int complete = super.complete(argument, argumentPosition, candidates);
|
||||
|
||||
logger.debug("complete:" + complete + ", size:" + candidates.size());
|
||||
|
||||
return complete;
|
||||
}
|
||||
|
||||
public void updateDataModelMetaData(Connection connection) {
|
||||
|
||||
try {
|
||||
Set<String> newModelCompletions = getDataModelMetadataCompletions(connection);
|
||||
logger.debug("New model metadata is:" + Joiner.on(',').join(newModelCompletions));
|
||||
|
||||
// Sets.difference(set1, set2) - returned set contains all elements that are contained by set1
|
||||
// and not contained by set2. set2 may also contain elements not present in set1; these are
|
||||
// simply ignored.
|
||||
SetView<String> removedCompletions = Sets.difference(modelCompletions, newModelCompletions);
|
||||
logger.debug("Removed Model Completions: " + Joiner.on(',').join(removedCompletions));
|
||||
this.getStrings().removeAll(removedCompletions);
|
||||
|
||||
SetView<String> newCompletions = Sets.difference(newModelCompletions, modelCompletions);
|
||||
logger.debug("New Completions: " + Joiner.on(',').join(newCompletions));
|
||||
this.getStrings().addAll(newCompletions);
|
||||
|
||||
modelCompletions = newModelCompletions;
|
||||
|
||||
} catch (SQLException e) {
|
||||
logger.error("Failed to update the metadata conmpletions", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Set<String> getSqlKeywordsCompletions(Connection connection) throws IOException,
|
||||
SQLException {
|
||||
|
||||
// Add the default SQL completions
|
||||
String keywords =
|
||||
new BufferedReader(new InputStreamReader(
|
||||
SqlCompleter.class.getResourceAsStream("/ansi.sql.keywords"))).readLine();
|
||||
|
||||
Set<String> completions = new TreeSet<>();
|
||||
|
||||
if (null != connection) {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
|
||||
// Add the driver specific SQL completions
|
||||
String driverSpecificKeywords =
|
||||
"/" + metaData.getDriverName().replace(" ", "-").toLowerCase() + "-sql.keywords";
|
||||
|
||||
logger.info("JDBC DriverName:" + driverSpecificKeywords);
|
||||
|
||||
if (SqlCompleter.class.getResource(driverSpecificKeywords) != null) {
|
||||
String driverKeywords =
|
||||
new BufferedReader(new InputStreamReader(
|
||||
SqlCompleter.class.getResourceAsStream(driverSpecificKeywords))).readLine();
|
||||
keywords += "," + driverKeywords.toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
// Add the keywords from the current JDBC connection
|
||||
try {
|
||||
keywords += "," + metaData.getSQLKeywords();
|
||||
} catch (Exception e) {
|
||||
logger.debug("fail to get SQL key words from database metadata: " + e, e);
|
||||
}
|
||||
try {
|
||||
keywords += "," + metaData.getStringFunctions();
|
||||
} catch (Exception e) {
|
||||
logger.debug("fail to get string function names from database metadata: " + e, e);
|
||||
}
|
||||
try {
|
||||
keywords += "," + metaData.getNumericFunctions();
|
||||
} catch (Exception e) {
|
||||
logger.debug("fail to get numeric function names from database metadata: " + e, e);
|
||||
}
|
||||
try {
|
||||
keywords += "," + metaData.getSystemFunctions();
|
||||
} catch (Exception e) {
|
||||
logger.debug("fail to get system function names from database metadata: " + e, e);
|
||||
}
|
||||
try {
|
||||
keywords += "," + metaData.getTimeDateFunctions();
|
||||
} catch (Exception e) {
|
||||
logger.debug("fail to get time date function names from database metadata: " + e, e);
|
||||
}
|
||||
|
||||
// Also allow lower-case versions of all the keywords
|
||||
keywords += "," + keywords.toLowerCase();
|
||||
|
||||
}
|
||||
|
||||
StringTokenizer tok = new StringTokenizer(keywords, ", ");
|
||||
while (tok.hasMoreTokens()) {
|
||||
completions.add(tok.nextToken());
|
||||
}
|
||||
|
||||
return completions;
|
||||
}
|
||||
|
||||
public static Set<String> getDataModelMetadataCompletions(Connection connection)
|
||||
throws SQLException {
|
||||
Set<String> completions = new TreeSet<>();
|
||||
if (null != connection) {
|
||||
getColumnNames(connection.getMetaData(), completions);
|
||||
getSchemaNames(connection.getMetaData(), completions);
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
|
||||
private static void getColumnNames(DatabaseMetaData meta, Set<String> names) throws SQLException {
|
||||
|
||||
try {
|
||||
ResultSet columns = meta.getColumns(meta.getConnection().getCatalog(), null, "%", "%");
|
||||
try {
|
||||
|
||||
while (columns.next()) {
|
||||
// Add the following strings: (1) column name, (2) table name
|
||||
String name = columns.getString("TABLE_NAME");
|
||||
if (!isBlank(name)) {
|
||||
names.add(name);
|
||||
names.add(columns.getString("COLUMN_NAME"));
|
||||
// names.add(columns.getString("TABLE_NAME") + "." + columns.getString("COLUMN_NAME"));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
columns.close();
|
||||
}
|
||||
|
||||
logger.debug(Joiner.on(',').join(names));
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to retrieve the column name", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void getSchemaNames(DatabaseMetaData meta, Set<String> names) throws SQLException {
|
||||
|
||||
try {
|
||||
ResultSet schemas = meta.getSchemas();
|
||||
try {
|
||||
while (schemas.next()) {
|
||||
String schemaName = schemas.getString("TABLE_SCHEM");
|
||||
if (!isBlank(schemaName)) {
|
||||
names.add(schemaName + ".");
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
schemas.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to retrieve the column name", e);
|
||||
}
|
||||
}
|
||||
|
||||
// test purpose only
|
||||
WhitespaceArgumentDelimiter getSqlDelimiter() {
|
||||
return this.sqlDelimiter;
|
||||
}
|
||||
}
|
||||
1
jdbc/src/main/resources/ansi.sql.keywords
Normal file
1
jdbc/src/main/resources/ansi.sql.keywords
Normal file
|
|
@ -0,0 +1 @@
|
|||
ABSOLUTE,ACTION,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,ASC,ASSERTION,AT,AUTHORIZATION,AVG,BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,CHAR,CHARACTER,CHAR_LENGTH,CHARACTER_LENGTH,CHECK,CLOSE,CLUSTER,COALESCE,COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,DISTINCT,DOMAIN,DOUBLE,DROP,ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,EXISTS,EXTERNAL,EXTRACT,FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FOUND,FROM,FULL,GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,IDENTITY,IMMEDIATE,IN,INDICATOR,INITIALLY,INNER,INPUT,INSENSITIVE,INSERT,INT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,MATCH,MAX,MIN,MINUTE,MODULE,MONTH,NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NOT,NULL,NULLIF,NUMERIC,OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,OVERWRITE,PAD,PARTIAL,PARTITION,POSITION,PRECISION,PREPARE,PRESERVE,PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,READ,REAL,REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS,SCHEMA,SCROLL,SECOND,SECTION,SELECT,SESSION,SESSION_USER,SET,SIZE,SMALLINT,SOME,SPACE,SQL,SQLCODE,SQLERROR,SQLSTATE,SUBSTRING,SUM,SYSTEM_USER,TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,WRITE,YEAR,ZONE,ADA,C,CATALOG_NAME,CHARACTER_SET_CATALOG,CHARACTER_SET_NAME,CHARACTER_SET_SCHEMA,CLASS_ORIGIN,COBOL,COLLATION_CATALOG,COLLATION_NAME,COLLATION_SCHEMA,COLUMN_NAME,COMMAND_FUNCTION,COMMITTED,CONDITION_NUMBER,CONNECTION_NAME,CONSTRAINT_CATALOG,CONSTRAINT_NAME,CONSTRAINT_SCHEMA,CURSOR_NAME,DATA,DATETIME_INTERVAL_CODE,DATETIME_INTERVAL_PRECISION,DYNAMIC_FUNCTION,FORTRAN,LENGTH,MESSAGE_LENGTH,MESSAGE_OCTET_LENGTH,MESSAGE_TEXT,MORE,MUMPS,NAME,NULLABLE,NUMBER,PASCAL,PLI,REPEATABLE,RETURNED_LENGTH,RETURNED_OCTET_LENGTH,RETURNED_SQLSTATE,ROW_COUNT,SCALE,SCHEMA_NAME,SERIALIZABLE,SERVER_NAME,SUBCLASS_ORIGIN,TABLE_NAME,TYPE,UNCOMMITTED,UNNAMED,LIMIT
|
||||
File diff suppressed because one or more lines are too long
10
licenses/LICENSE-sqlline-1.0.2
Normal file
10
licenses/LICENSE-sqlline-1.0.2
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Copyright (c)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
4
pom.xml
4
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>
|
||||
|
|
@ -496,6 +495,9 @@
|
|||
<exclude>docs/sitemap.txt</exclude>
|
||||
<exclude>**/dependency-reduced-pom.xml</exclude>
|
||||
|
||||
<!-- bundled from anchor -->
|
||||
<exclude>docs/assets/themes/zeppelin/js/anchor.min.js</exclude>
|
||||
|
||||
<!-- bundled from jekyll -->
|
||||
<exclude>docs/assets/themes/zeppelin/css/syntax.css</exclude>
|
||||
|
||||
|
|
|
|||
2
scripts/vagrant/zeppelin-dev/.gitignore
vendored
2
scripts/vagrant/zeppelin-dev/.gitignore
vendored
|
|
@ -1,4 +1,4 @@
|
|||
.vagrant
|
||||
.DS_Store
|
||||
incubator-zeppelin
|
||||
zeppelin
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ curl -fsSL https://raw.githubusercontent.com/NFLabs/z-manager/master/zeppelin-in
|
|||
|
||||
### Building Zeppelin
|
||||
|
||||
You can now `git clone git://git.apache.org/incubator-zeppelin.git` into a directory on your host machine, or directly in your virtual machine.
|
||||
You can now `git clone git://git.apache.org/zeppelin.git` into a directory on your host machine, or directly in your virtual machine.
|
||||
|
||||
Cloning zeppelin into the `/scripts/vagrant/zeppelin-dev` directory from the host, will allow the directory to be shared between your host and the guest machine.
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ Cloning the project again may seem counter intuitive, since this script likley o
|
|||
Synced folders enable Vagrant to sync a folder on the host machine to the guest machine, allowing you to continue working on your project's files on your host machine, but use the resources in the guest machine to compile or run your project. _[(1) Synced Folder Description from Vagrant Up](https://docs.vagrantup.com/v2/synced-folders/index.html)_
|
||||
|
||||
By default, Vagrant will share your project directory (the directory with the Vagrantfile) to `/vagrant`. Which means you should be able to build within the guest machine after you
|
||||
`cd /vagrant/incubator-zeppelin`
|
||||
`cd /vagrant/zeppelin`
|
||||
|
||||
|
||||
### What's in this VM?
|
||||
|
|
@ -86,7 +86,7 @@ The virtual machine consists of:
|
|||
This assumes you've already cloned the project either on the host machine in the zeppelin-dev directory (to be shared with the guest machine) or cloned directly into a directory while running inside the guest machine. The following build steps will also include Python and R support via PySpark and SparkR:
|
||||
|
||||
```
|
||||
cd /incubator-zeppelin
|
||||
cd /zeppelin
|
||||
mvn clean package -Pspark-1.6 -Ppyspark -Phadoop-2.4 -Psparkr -DskipTests
|
||||
./bin/zeppelin-daemon.sh start
|
||||
```
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
echo '# Post vagrant up instructions.'
|
||||
echo '# From your host machine,'
|
||||
echo '# git clone the incubator-zeppelin branch into this directory'
|
||||
echo '# git clone the zeppelin branch into this directory'
|
||||
echo
|
||||
echo 'git clone git://git.apache.org/incubator-zeppelin.git'
|
||||
echo 'git clone git://git.apache.org/zeppelin.git'
|
||||
echo
|
||||
echo '# Cloning the project again may seem counter intuitive, since this script'
|
||||
echo '# originated from the project repository. Consider copying just the vagrant/zeppelin-dev'
|
||||
|
|
@ -29,7 +29,7 @@ echo 'vagrant ssh'
|
|||
echo
|
||||
echo '# then when running inside the VM'
|
||||
echo
|
||||
echo 'cd /vagrant/incubator-zeppelin'
|
||||
echo 'cd /vagrant/zeppelin'
|
||||
echo 'mvn clean package -DskipTests'
|
||||
echo
|
||||
echo '# or for a specific Spark/Hadoop build with additional options such as python and R support'
|
||||
|
|
|
|||
|
|
@ -118,6 +118,9 @@ class SparkVersion(object):
|
|||
return self.version >= self.SPARK_1_3_0
|
||||
|
||||
class PySparkCompletion:
|
||||
def __init__(self, interpreterObject):
|
||||
self.interpreterObject = interpreterObject
|
||||
|
||||
def getGlobalCompletion(self):
|
||||
objectDefList = []
|
||||
try:
|
||||
|
|
@ -159,9 +162,10 @@ class PySparkCompletion:
|
|||
for completionItem in list(objectCompletionList):
|
||||
completionList.add(completionItem)
|
||||
if len(completionList) <= 0:
|
||||
print("")
|
||||
self.interpreterObject.setStatementsFinished("", False)
|
||||
else:
|
||||
print(json.dumps(list(filter(lambda x : not re.match("^__.*", x), list(completionList)))))
|
||||
result = json.dumps(list(filter(lambda x : not re.match("^__.*", x), list(completionList))))
|
||||
self.interpreterObject.setStatementsFinished(result, False)
|
||||
|
||||
|
||||
output = Logger()
|
||||
|
|
@ -205,7 +209,7 @@ sc = SparkContext(jsc=jsc, gateway=gateway, conf=conf)
|
|||
sqlc = SQLContext(sc, intp.getSQLContext())
|
||||
sqlContext = sqlc
|
||||
|
||||
completion = PySparkCompletion()
|
||||
completion = PySparkCompletion(intp)
|
||||
z = PyZeppelinContext(intp.getZeppelinContext())
|
||||
|
||||
while True :
|
||||
|
|
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -36,13 +36,11 @@ The following components are provided under Apache License.
|
|||
(Apache 2.0) Apache Curator (org.apache.curator:curator:2.4.0 - http://curator.apache.org/)
|
||||
(Apache 2.0) Apache Cassandra (http://cassandra.apache.org/)
|
||||
(Apache 2.0) Apache CXF (http://cxf.apache.org/)
|
||||
(Apache 2.0) Apache Hive (http://hive.apache.org/)
|
||||
(Apache 2.0) Apache HBase (http://hbase.apache.org/)
|
||||
(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 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/)
|
||||
|
|
@ -112,7 +110,7 @@ MIT licenses
|
|||
The following components are provided under the MIT License. See project link for details.
|
||||
The text of each license is also included at licenses/LICENSE-[project]-[version].txt.
|
||||
|
||||
(The MIT License) AngularJS v1.3.8 (https://angularjs.org/) - https://github.com/angular/angular.js/blob/v1.3.8/LICENSE
|
||||
(The MIT License) AngularJS v1.5.0 (https://angularjs.org/) - https://github.com/angular/angular.js/blob/v1.5.0/LICENSE
|
||||
(The MIT License) Json3 v3.3.1 (http://bestiejs.github.io/json3) - https://github.com/bestiejs/json3/blob/v3.3.1/LICENSE
|
||||
(The MIT License) es5-shim v3.1.0 (https://github.com/es-shims/es5-shim) - https://github.com/es-shims/es5-shim/blob/v3.1.0/LICENSE
|
||||
(The MIT License) bootstrap v3.2.0 (http://getbootstrap.com/) - https://github.com/twbs/bootstrap/blob/v3.2.0/LICENSE
|
||||
|
|
@ -123,14 +121,14 @@ The text of each license is also included at licenses/LICENSE-[project]-[version
|
|||
(The MIT License) jquery.scrollTo v1.4.13 (https://github.com/flesler/jquery.scrollTo) - https://github.com/flesler/jquery.scrollTo/blob/1.4.13/LICENSE
|
||||
(The MIT License) angular-dragdrop v1.0.8 (http://codef0rmer.github.io/angular-dragdrop/#/) - https://github.com/codef0rmer/angular-dragdrop/blob/v1.0.8/LICENSE
|
||||
(The MIT License) perfect-scrollbar v0.5.4 (http://noraesae.github.io/perfect-scrollbar/) - https://github.com/noraesae/perfect-scrollbar/tree/0.5.4
|
||||
(The MIT License) ng-sortable v1.1.9 (https://github.com/a5hik/ng-sortable) - https://github.com/a5hik/ng-sortable/blob/1.1.9/LICENSE
|
||||
(The MIT License) ng-sortable v1.3.6 (https://github.com/a5hik/ng-sortable) - https://github.com/a5hik/ng-sortable/blob/1.3.6/LICENSE
|
||||
(The MIT License) angular-elastic v2.4.2 (https://github.com/monospaced/angular-elastic) - https://github.com/monospaced/angular-elastic/blob/v2.4.2/LICENCE.txt
|
||||
(The MIT License) angular-elastic-input v2.2.0 (https://github.com/jacek-pulit/angular-elastic-input) - https://github.com/jacek-pulit/angular-elastic-input/blob/v2.2.0/LICENSE
|
||||
(The MIT License) ng-focus-if v1.0.2 (https://github.com/hiebj/ng-focus-if) - https://github.com/hiebj/ng-focus-if/blob/v1.0.2/LICENSE
|
||||
(The MIT License) angular-xeditable v0.1.8 (http://vitalets.github.io/angular-xeditable/) - https://github.com/vitalets/angular-xeditable/tree/0.1.8
|
||||
(The MIT License) lodash v3.9.3 (https://lodash.com/) - https://github.com/lodash/lodash/blob/3.9.3/LICENSE.txt
|
||||
(The MIT License) angular-filter v0.5.4 (https://github.com/a8m/angular-filter) - https://github.com/a8m/angular-filter/blob/v0.5.4/license.md
|
||||
(The MIT License) ngToast v1.5.5 (http://tamerayd.in/ngToast/) - http://tameraydin.mit-license.org/
|
||||
(The MIT License) ngToast v2.0.0 (http://tamerayd.in/ngToast/) - http://tameraydin.mit-license.org/
|
||||
(The MIT License) Handsontable v0.24.2 (https://github.com/handsontable/handsontable) - https://github.com/handsontable/handsontable/blob/master/LICENSE
|
||||
(The MIT License) Zeroclipboard v2.2.0 (https://github.com/zeroclipboard/zeroclipboard) - https://github.com/zeroclipboard/zeroclipboard/blob/v2.2.0/LICENSE
|
||||
(The MIT License) Moment v2.9.0 (https://github.com/moment/moment) - https://github.com/moment/moment/blob/2.9.0/LICENSE
|
||||
|
|
@ -138,7 +136,8 @@ The text of each license is also included at licenses/LICENSE-[project]-[version
|
|||
(The MIT License) slf4j v1.7.10 (org.slf4j:slf4j-api:jar:1.7.10 - http://www.slf4j.org) - http://www.slf4j.org/license.html
|
||||
(The MIT License) slf4j-log4j12 v1.7.10 (org.slf4j:slf4j-log4j12:jar:1.7.10 - http://www.slf4j.org) - http://www.slf4j.org/license.html
|
||||
(The MIT License) bcprov-jdk15on v1.51 (org.bouncycastle:bcprov-jdk15on:jar:1.51 - http://www.bouncycastle.org/java.html) - http://www.bouncycastle.org/licence.html
|
||||
|
||||
(The MIT License) AnchorJS (https://github.com/bryanbraun/anchorjs) - https://github.com/bryanbraun/anchorjs/blob/master/README.md#license
|
||||
|
||||
The following components are provided under the MIT License.
|
||||
|
||||
(The MIT License) Objenesis (org.objenesis:objenesis:2.1 - https://github.com/easymock/objenesis) - Copyright (c) 2006-2015 the original author and authors
|
||||
|
|
@ -160,7 +159,7 @@ The text of each license is also included at licenses/LICENSE-[project]-[version
|
|||
(BSD 3 Clause) Ace v1.1.9 (http://ace.c9.io/) - https://github.com/ajaxorg/ace/blob/v1.1.9/LICENSE
|
||||
(BSD Style) dom4j v1.6.1 (http://www.dom4j.org) - https://github.com/dom4j/dom4j/blob/dom4j_1_6_1/LICENSE.txt
|
||||
(BSD Style) JSch v0.1.53 (http://www.jcraft.com) - http://www.jcraft.com/jsch/LICENSE.txt
|
||||
(BSD 3 Clause) highlightjs v8.4.0 (https://highlightjs.org/) - https://github.com/isagalaev/highlight.js/blob/8.4/LICENSE
|
||||
(BSD 3 Clause) highlightjs v9.4.0 (https://highlightjs.org/) - https://github.com/isagalaev/highlight.js/blob/9.4.0/LICENSE
|
||||
(BSD 3 Clause) hamcrest v1.3 (http://hamcrest.org/JavaHamcrest/) - http://opensource.org/licenses/BSD-3-Clause
|
||||
(BSD Style) JLine v2.12.1 (https://github.com/jline/jline2) - https://github.com/jline/jline2/blob/master/LICENSE.txt
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2014 Google, Inc. http://angularjs.org
|
||||
Copyright (c) 2010-2016 Google, Inc. http://angularjs.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
The MIT License (MIT)
|
||||
Copyright © 2015 Tamer Aydin, http://tamerayd.in
|
||||
Copyright © 2016 Tamer Aydin, http://tamerayd.in
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
@ -52,8 +52,8 @@ public abstract class AbstractDependencyResolver {
|
|||
synchronized (repos) {
|
||||
delRepo(id);
|
||||
RemoteRepository rr = new RemoteRepository(id, "default", url);
|
||||
rr.setPolicy(true, new RepositoryPolicy(
|
||||
snapshot,
|
||||
rr.setPolicy(snapshot, new RepositoryPolicy(
|
||||
true,
|
||||
RepositoryPolicy.UPDATE_POLICY_DAILY,
|
||||
RepositoryPolicy.CHECKSUM_POLICY_WARN));
|
||||
repos.add(rr);
|
||||
|
|
@ -64,8 +64,8 @@ public abstract class AbstractDependencyResolver {
|
|||
synchronized (repos) {
|
||||
delRepo(id);
|
||||
RemoteRepository rr = new RemoteRepository(id, "default", url);
|
||||
rr.setPolicy(true, new RepositoryPolicy(
|
||||
snapshot,
|
||||
rr.setPolicy(snapshot, new RepositoryPolicy(
|
||||
true,
|
||||
RepositoryPolicy.UPDATE_POLICY_DAILY,
|
||||
RepositoryPolicy.CHECKSUM_POLICY_WARN));
|
||||
rr.setAuthentication(auth);
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class DependencyContext {
|
|||
throws DependencyResolutionException, ArtifactResolutionException {
|
||||
Artifact artifact = new DefaultArtifact(dep.getGroupArtifactVersion());
|
||||
|
||||
DependencyFilter classpathFlter = DependencyFilterUtils
|
||||
DependencyFilter classpathFilter = DependencyFilterUtils
|
||||
.classpathFilter(JavaScopes.COMPILE);
|
||||
PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter(
|
||||
dep.getExclusions());
|
||||
|
|
@ -133,7 +133,7 @@ public class DependencyContext {
|
|||
}
|
||||
|
||||
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest,
|
||||
DependencyFilterUtils.andFilter(exclusionFilter, classpathFlter));
|
||||
DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter));
|
||||
|
||||
return system.resolveDependencies(session, dependencyRequest).getArtifactResults();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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.interpreter;
|
||||
/**
|
||||
* Interpreter related constants
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class Constants {
|
||||
public static final String ZEPPELIN_INTERPRETER_PORT = "zeppelin.interpreter.port";
|
||||
|
||||
public static final String ZEPPELIN_INTERPRETER_HOST = "zeppelin.interpreter.host";
|
||||
|
||||
public static final String EXISTING_PROCESS = "existing_process";
|
||||
|
||||
}
|
||||
|
|
@ -56,8 +56,7 @@ public class ZeppelinDevServer extends
|
|||
|
||||
Interpreter intp = super.getInterpreter(noteId, className);
|
||||
interpreter = (DevInterpreter) (
|
||||
(ClassloaderInterpreter) ((LazyOpenInterpreter) intp).getInnerInterpreter())
|
||||
.getInnerInterpreter();
|
||||
((LazyOpenInterpreter) intp).getInnerInterpreter());
|
||||
interpreter.setInterpreterEvent(this);
|
||||
notify();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,18 +21,20 @@ import org.apache.commons.exec.*;
|
|||
import org.apache.commons.pool2.impl.GenericObjectPool;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.zeppelin.helium.ApplicationEventListener;
|
||||
import org.apache.zeppelin.interpreter.Constants;
|
||||
import org.apache.zeppelin.interpreter.InterpreterException;
|
||||
import org.apache.zeppelin.interpreter.InterpreterGroup;
|
||||
import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Abstract class for interpreter process
|
||||
*/
|
||||
public abstract class RemoteInterpreterProcess {
|
||||
private static final Logger logger = LoggerFactory.getLogger(RemoteInterpreterProcess.class);
|
||||
|
||||
private final AtomicInteger referenceCount;
|
||||
private ExecuteWatchdog watchdog;
|
||||
|
||||
|
|
@ -40,6 +42,8 @@ public abstract class RemoteInterpreterProcess {
|
|||
private final RemoteInterpreterEventPoller remoteInterpreterEventPoller;
|
||||
private final InterpreterContextRunnerPool interpreterContextRunnerPool;
|
||||
private int connectTimeout;
|
||||
String host = "localhost";
|
||||
boolean isInterpreterAlreadyExecuting = false;
|
||||
|
||||
public RemoteInterpreterProcess(
|
||||
int connectTimeout,
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ public class RemoteInterpreterServer
|
|||
replClass.getConstructor(new Class[] {Properties.class});
|
||||
Interpreter repl = constructor.newInstance(p);
|
||||
|
||||
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||
repl.setClassloaderUrls(new URL[]{});
|
||||
|
||||
synchronized (interpreterGroup) {
|
||||
|
|
@ -176,7 +175,7 @@ public class RemoteInterpreterServer
|
|||
interpreterGroup.put(noteId, interpreters);
|
||||
}
|
||||
|
||||
interpreters.add(new LazyOpenInterpreter(new ClassloaderInterpreter(repl, cl)));
|
||||
interpreters.add(new LazyOpenInterpreter(repl));
|
||||
}
|
||||
|
||||
logger.info("Instantiate interpreter {}", className);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,11 @@ import static org.junit.Assert.assertFalse;
|
|||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.apache.zeppelin.interpreter.Constants;
|
||||
import org.apache.zeppelin.interpreter.InterpreterGroup;
|
||||
import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client;
|
||||
import org.junit.Test;
|
||||
|
|
@ -32,6 +36,7 @@ public class RemoteInterpreterProcessTest {
|
|||
System.getProperty("os.name").startsWith("Windows") ?
|
||||
"../bin/interpreter.cmd" :
|
||||
"../bin/interpreter.sh";
|
||||
private static final int DUMMY_PORT=3678;
|
||||
|
||||
@Test
|
||||
public void testStartStop() {
|
||||
|
|
@ -70,4 +75,38 @@ public class RemoteInterpreterProcessTest {
|
|||
|
||||
rip.dereference();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartStopRemoteInterpreter() throws TException, InterruptedException {
|
||||
RemoteInterpreterServer server = new RemoteInterpreterServer(3678);
|
||||
server.start();
|
||||
boolean running = false;
|
||||
long startTime = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - startTime < 10 * 1000) {
|
||||
if (server.isRunning()) {
|
||||
running = true;
|
||||
break;
|
||||
} else {
|
||||
Thread.sleep(200);
|
||||
}
|
||||
}
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(Constants.ZEPPELIN_INTERPRETER_PORT, "3678");
|
||||
properties.setProperty(Constants.ZEPPELIN_INTERPRETER_HOST, "localhost");
|
||||
InterpreterGroup intpGroup = mock(InterpreterGroup.class);
|
||||
when(intpGroup.getProperty()).thenReturn(properties);
|
||||
when(intpGroup.containsKey(Constants.EXISTING_PROCESS)).thenReturn(true);
|
||||
|
||||
RemoteInterpreterProcess rip = new RemoteInterpreterManagedProcess(
|
||||
INTERPRETER_SCRIPT,
|
||||
"nonexists",
|
||||
"fakeRepo",
|
||||
new HashMap<String, String>(),
|
||||
mock(RemoteInterpreterEventPoller.class)
|
||||
, 10 * 1000);
|
||||
assertFalse(rip.isRunning());
|
||||
assertEquals(0, rip.referenceCount());
|
||||
assertEquals(1, rip.reference(intpGroup));
|
||||
assertEquals(true, rip.isRunning());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ limitations under the License.
|
|||
<div class="col-md-6">
|
||||
<h4>Help</h4>
|
||||
Get started with <a style="text-decoration: none;" target="_blank"
|
||||
href="http://zeppelin.apache.org/docs/latest/index.html">Zeppelin documentation</a><br>
|
||||
href="http://zeppelin.apache.org/docs/{{zeppelinVersion}}/index.html">Zeppelin documentation</a><br>
|
||||
|
||||
<h4>Community</h4>
|
||||
Please feel free to help us to improve Zeppelin, <br>
|
||||
|
|
|
|||
|
|
@ -69,6 +69,24 @@ limitations under the License.
|
|||
<span>Interpreter for note</span>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="col-md-12" style="padding-left:0px">
|
||||
<div class="checkbox">
|
||||
<span class="input-group">
|
||||
<label><input type="checkbox" style="width:0%;height:0%" ng-model="newInterpreterSetting.option.isExistingProcess"> </input> Connect to existing process </label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-show="newInterpreterSetting.option.isExistingProcess" class="form-group" style="width:200px">
|
||||
<b>Host</b>
|
||||
<input id="newInterpreterSettingHost" input pu-elastic-input
|
||||
pu-elastic-input-minwidth="180px" ng-model="newInterpreterSetting.option.host" />
|
||||
</div>
|
||||
<div ng-show="newInterpreterSetting.option.isExistingProcess" class="form-group" style="width:200px">
|
||||
<b>Port</b>
|
||||
<input id="newInterpreterSettingPort" input pu-elastic-input
|
||||
pu-elastic-input-minwidth="180px" ng-model="newInterpreterSetting.option.port" />
|
||||
</div>
|
||||
|
||||
<b>Properties</b>
|
||||
<table class="table table-striped properties">
|
||||
|
|
|
|||
|
|
@ -120,6 +120,9 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope,
|
|||
if (!setting.option) {
|
||||
setting.option = {};
|
||||
}
|
||||
if (setting.option.isExistingProcess === undefined) {
|
||||
setting.option.isExistingProcess = false;
|
||||
}
|
||||
if (setting.option.remote === undefined) {
|
||||
// remote always true for now
|
||||
setting.option.remote = true;
|
||||
|
|
@ -273,8 +276,10 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope,
|
|||
dependencies: [],
|
||||
option: {
|
||||
remote: true,
|
||||
isExistingProcess: false,
|
||||
perNoteSession: false,
|
||||
perNoteProcess: false
|
||||
|
||||
}
|
||||
};
|
||||
emptyNewProperty($scope.newInterpreterSetting);
|
||||
|
|
|
|||
|
|
@ -152,6 +152,28 @@ limitations under the License.
|
|||
</span>
|
||||
<span>Interpreter for note</span>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="col-md-12">
|
||||
<div class="checkbox">
|
||||
<span class="input-group">
|
||||
<label><input type="checkbox" style="width:0%;height:0%" id="isExistingProcess" ng-model="setting.option.isExistingProcess" ng-disabled="!valueform.$visible"> </input>
|
||||
Connect to existing process <label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12" ng-show="setting.option.isExistingProcess">
|
||||
<b>Host</b>
|
||||
<input id="newInterpreterSettingHost" input pu-elastic-input
|
||||
pu-elastic-input-minwidth="180px" ng-model="setting.option.host" ng-disabled="!valueform.$visible" />
|
||||
</div>
|
||||
<div class="col-md-12" ng-show="setting.option.isExistingProcess">
|
||||
<b>Port</b>
|
||||
<input id="newInterpreterSettingPort" input pu-elastic-input
|
||||
pu-elastic-input-minwidth="180px" ng-model="setting.option.port" ng-disabled="!valueform.$visible" />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-show="_.isEmpty(setting.properties) && _.isEmpty(setting.dependencies) || valueform.$hidden" class="col-md-12 gray40-message">
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ limitations under the License.
|
|||
ng-class="{'active': isGraphMode('scatterChart')}"
|
||||
ng-click="setGraphMode('scatterChart', true)"><i class="cf cf-scatter-chart"></i>
|
||||
</button>
|
||||
|
||||
<button type="button"
|
||||
ng-if="paragraph.result.type != 'TABLE'"
|
||||
ng-click="switchApp()"
|
||||
|
|
@ -61,6 +62,19 @@ limitations under the License.
|
|||
ng-bind-html="app.pkg.icon">
|
||||
</button>
|
||||
|
||||
<span>
|
||||
<button type="button" class="btn btn-default btn-sm" style="margin-left:10px"
|
||||
tooltip="Download Data as TSV" tooltip-placement="bottom"
|
||||
ng-click="exportToTSV()"><i class="fa fa-download"></i>
|
||||
</button>
|
||||
</span>
|
||||
<span
|
||||
ng-if="getResultType()=='TABLE' && !paragraph.config.helium.activeApp && getGraphMode()!='table' && !asIframe && !viewOnly"
|
||||
style="margin-left:10px; cursor:pointer; display: inline-block; vertical-align:top; position: relative; line-height:30px;">
|
||||
<a class="btnText" ng-click="toggleGraphOption()">
|
||||
settings <span ng-class="paragraph.config.graph.optionOpen ? 'fa fa-caret-up' : 'fa fa-caret-down'"></span>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="{{paragraph.id}}_helium"
|
||||
|
|
@ -92,16 +106,3 @@ limitations under the License.
|
|||
</div>
|
||||
|
||||
|
||||
<span>
|
||||
<button type="button" class="btn btn-default btn-sm" style="margin-left:10px"
|
||||
tooltip="Download Data as TSV" tooltip-placement="bottom"
|
||||
ng-click="exportToTSV()"><i class="fa fa-download"></i>
|
||||
</button>
|
||||
</span>
|
||||
<span
|
||||
ng-if="getResultType()=='TABLE' && !paragraph.config.helium.activeApp && getGraphMode()!='table' && !asIframe && !viewOnly"
|
||||
style="margin-left:10px; cursor:pointer; display: inline-block; vertical-align:top; position: relative; line-height:30px;">
|
||||
<a class="btnText" ng-click="toggleGraphOption()">
|
||||
settings <span ng-class="paragraph.config.graph.optionOpen ? 'fa fa-caret-up' : 'fa fa-caret-down'"></span>
|
||||
</a>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ 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.
|
||||
-->
|
||||
<input type="text" class="note-name-query form-control" ng-click="$event.stopPropagation()" placeholder=" Filter" ng-model="$parent.query.name" />
|
||||
<input type="text" class="note-name-query form-control" ng-click="$event.stopPropagation()" placeholder=" Filter" ng-model="$parent.query" />
|
||||
|
|
|
|||
|
|
@ -14,7 +14,45 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
angular.module('zeppelinWebApp').controller('NavCtrl', function($scope, $rootScope, $http, $routeParams,
|
||||
angular.module('zeppelinWebApp')
|
||||
.filter('notebookFilter', function() {
|
||||
return function (notebooks, searchText)
|
||||
{
|
||||
if (!searchText) {
|
||||
return notebooks;
|
||||
}
|
||||
|
||||
var filteringNote = function(notebooks, filteredNotes) {
|
||||
_.each(notebooks, function(notebook) {
|
||||
|
||||
if (notebook.name.toLowerCase().indexOf(searchText) !== -1) {
|
||||
filteredNotes.push(notebook);
|
||||
return notebook;
|
||||
}
|
||||
|
||||
if (notebook.children) {
|
||||
filteringNote(notebook.children, filteredNotes);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return _.filter(notebooks, function(notebook) {
|
||||
if (notebook.children) {
|
||||
var filteredNotes = [];
|
||||
filteringNote(notebook.children, filteredNotes);
|
||||
|
||||
if (filteredNotes.length > 0) {
|
||||
return filteredNotes;
|
||||
}
|
||||
}
|
||||
|
||||
if (notebook.name.toLowerCase().indexOf(searchText) !== -1) {
|
||||
return notebook;
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
.controller('NavCtrl', function($scope, $rootScope, $http, $routeParams,
|
||||
$location, notebookListDataFactory, baseUrlSrv, websocketMsgSrv, arrayOrderingSrv) {
|
||||
/** Current list of notes (ids) */
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ limitations under the License.
|
|||
<li class="divider"></li>
|
||||
<div id="notebook-list" class="scrollbar-container">
|
||||
<li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li>
|
||||
<li ng-repeat="note in navbar.notes.root.children | filter:query track by $index" ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'notebook_list_renderer.html'">
|
||||
</li>
|
||||
<li ng-repeat="note in navbar.notes.root.children |notebookFilter:query track by $index" ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'notebook_list_renderer.html'"></li>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -500,7 +500,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,"
|
||||
|
|
|
|||
|
|
@ -555,7 +555,10 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
String groupName = interpreterSetting.getGroup();
|
||||
InterpreterOption option = interpreterSetting.getOption();
|
||||
Properties properties = interpreterSetting.getProperties();
|
||||
|
||||
if (option.isExistingProcess) {
|
||||
properties.put(Constants.ZEPPELIN_INTERPRETER_HOST, option.getHost());
|
||||
properties.put(Constants.ZEPPELIN_INTERPRETER_PORT, option.getPort());
|
||||
}
|
||||
// if interpreters are already there, wait until they're being removed
|
||||
synchronized (interpreterGroup) {
|
||||
long interpreterRemovalWaitStart = System.nanoTime();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,26 @@ public class InterpreterOption {
|
|||
int port = -1;
|
||||
boolean perNoteSession;
|
||||
boolean perNoteProcess;
|
||||
|
||||
boolean isExistingProcess;
|
||||
|
||||
|
||||
public boolean isExistingProcess() {
|
||||
return isExistingProcess;
|
||||
}
|
||||
|
||||
public void setExistingProcess(boolean isExistingProcess) {
|
||||
this.isExistingProcess = isExistingProcess;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
|
||||
public InterpreterOption() {
|
||||
remote = false;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ public class InterpreterSetting {
|
|||
|
||||
|
||||
private String getInterpreterProcessKey(String noteId) {
|
||||
if (getOption().isPerNoteProcess()) {
|
||||
if (getOption().isExistingProcess) {
|
||||
return Constants.EXISTING_PROCESS;
|
||||
} else if (getOption().isPerNoteProcess()) {
|
||||
return noteId;
|
||||
} else {
|
||||
return SHARED_PROCESS;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,23 @@ public class Note implements Serializable, ParagraphJobListener {
|
|||
return name;
|
||||
}
|
||||
|
||||
private String normalizeNoteName(String name){
|
||||
name = name.trim();
|
||||
name = name.replace("\\", "/");
|
||||
while (name.indexOf("///") >= 0) {
|
||||
name = name.replaceAll("///", "/");
|
||||
}
|
||||
name = name.replaceAll("//", "/");
|
||||
if (name.length() == 0) {
|
||||
name = "/";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
if (name.indexOf('/') >= 0 || name.indexOf('\\') >= 0) {
|
||||
name = normalizeNoteName(name);
|
||||
}
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.zeppelin.interpreter.Constants;
|
||||
import org.apache.zeppelin.interpreter.Interpreter;
|
||||
import org.apache.zeppelin.interpreter.Interpreter.RegisteredInterpreter;
|
||||
import org.apache.zeppelin.interpreter.InterpreterException;
|
||||
|
|
@ -76,7 +77,9 @@ public class NoteInterpreterLoader {
|
|||
}
|
||||
|
||||
private String getInterpreterInstanceKey(InterpreterSetting setting) {
|
||||
if (setting.getOption().isPerNoteSession() || setting.getOption().isPerNoteProcess()) {
|
||||
if (setting.getOption().isExistingProcess()) {
|
||||
return Constants.EXISTING_PROCESS;
|
||||
} else if (setting.getOption().isPerNoteSession() || setting.getOption().isPerNoteProcess()) {
|
||||
return noteId;
|
||||
} else {
|
||||
return SHARED_SESSION;
|
||||
|
|
|
|||
|
|
@ -704,6 +704,31 @@ public class NotebookTest implements JobListenerFactory{
|
|||
assertEquals(1, onParagraphRemove.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNormalizeNoteName() throws IOException {
|
||||
// create a notes
|
||||
Note note1 = notebook.createNote();
|
||||
|
||||
note1.setName("MyNote");
|
||||
assertEquals(note1.getName(), "MyNote");
|
||||
|
||||
note1.setName("/MyNote");
|
||||
assertEquals(note1.getName(), "/MyNote");
|
||||
|
||||
note1.setName("MyNote/sub");
|
||||
assertEquals(note1.getName(), "MyNote/sub");
|
||||
|
||||
note1.setName("/MyNote/sub");
|
||||
assertEquals(note1.getName(), "/MyNote/sub");
|
||||
|
||||
note1.setName("///////MyNote//////sub");
|
||||
assertEquals(note1.getName(), "/MyNote/sub");
|
||||
|
||||
note1.setName("\\\\\\MyNote///sub");
|
||||
assertEquals(note1.getName(), "/MyNote/sub");
|
||||
|
||||
notebook.removeNote(note1.getId());
|
||||
}
|
||||
|
||||
private void delete(File file){
|
||||
if(file.isFile()) file.delete();
|
||||
|
|
|
|||
Loading…
Reference in a new issue