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
6a5a19ea9d
64 changed files with 805 additions and 165 deletions
|
|
@ -28,6 +28,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -174,13 +175,13 @@ public class AlluxioInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
String[] words = splitAndRemoveEmpty(splitAndRemoveEmpty(buf, "\n"), " ");
|
||||
String lastWord = "";
|
||||
if (words.length > 0) {
|
||||
lastWord = words[ words.length - 1 ];
|
||||
}
|
||||
ArrayList<String> voices = new ArrayList<String>();
|
||||
ArrayList voices = new ArrayList<>();
|
||||
for (String command : keywords) {
|
||||
if (command.startsWith(lastWord)) {
|
||||
voices.add(command);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import alluxio.client.WriteType;
|
|||
import alluxio.client.file.URIStatus;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.junit.*;
|
||||
|
||||
import alluxio.Constants;
|
||||
|
|
@ -76,19 +77,19 @@ public class AlluxioInterpreterTest {
|
|||
|
||||
@Test
|
||||
public void testCompletion() {
|
||||
List<String> expectedResultOne = Arrays.asList("cat", "chgrp",
|
||||
List expectedResultOne = Arrays.asList("cat", "chgrp",
|
||||
"chmod", "chown", "copyFromLocal", "copyToLocal", "count",
|
||||
"createLineage");
|
||||
List<String> expectedResultTwo = Arrays.asList("copyFromLocal",
|
||||
List expectedResultTwo = Arrays.asList("copyFromLocal",
|
||||
"copyToLocal", "count");
|
||||
List<String> expectedResultThree = Arrays.asList("copyFromLocal", "copyToLocal");
|
||||
List<String> expectedResultNone = new ArrayList<String>();
|
||||
List expectedResultThree = Arrays.asList("copyFromLocal", "copyToLocal");
|
||||
List expectedResultNone = new ArrayList<String>();
|
||||
|
||||
List<String> resultOne = alluxioInterpreter.completion("c", 0);
|
||||
List<String> resultTwo = alluxioInterpreter.completion("co", 0);
|
||||
List<String> resultThree = alluxioInterpreter.completion("copy", 0);
|
||||
List<String> resultNotMatch = alluxioInterpreter.completion("notMatch", 0);
|
||||
List<String> resultAll = alluxioInterpreter.completion("", 0);
|
||||
List<InterpreterCompletion> resultOne = alluxioInterpreter.completion("c", 0);
|
||||
List<InterpreterCompletion> resultTwo = alluxioInterpreter.completion("co", 0);
|
||||
List<InterpreterCompletion> resultThree = alluxioInterpreter.completion("copy", 0);
|
||||
List<InterpreterCompletion> resultNotMatch = alluxioInterpreter.completion("notMatch", 0);
|
||||
List<InterpreterCompletion> resultAll = alluxioInterpreter.completion("", 0);
|
||||
|
||||
Assert.assertEquals(expectedResultOne, resultOne);
|
||||
Assert.assertEquals(expectedResultTwo, resultTwo);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Type;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
||||
|
|
@ -69,8 +70,8 @@ public class AngularInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
return new LinkedList<String>();
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ 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.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -139,7 +140,7 @@ public class CassandraInterpreter extends Interpreter {
|
|||
public static final String LOGGING_DOWNGRADING_RETRY = "LOGGING_DOWNGRADING";
|
||||
public static final String LOGGING_FALLTHROUGH_RETRY = "LOGGING_FALLTHROUGH";
|
||||
|
||||
public static final List<String> NO_COMPLETION = new ArrayList<>();
|
||||
public static final List NO_COMPLETION = new ArrayList<>();
|
||||
|
||||
InterpreterLogic helper;
|
||||
Cluster cluster;
|
||||
|
|
@ -320,7 +321,7 @@ public class CassandraInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return NO_COMPLETION;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ limitations under the License.
|
|||
</ul>
|
||||
</div>
|
||||
<div class="col-md-6" style="padding:0">
|
||||
<img class="img-responsive" style="border: 1px solid #ecf0f1;" src="../assets/themes/zeppelin/img/notebook.png" />
|
||||
<img class="img-responsive" style="border: 1px solid #ecf0f1;" src="./assets/themes/zeppelin/img/notebook.png" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -42,14 +42,14 @@ limitations under the License.
|
|||
[Apache Zeppelin interpreter](./manual/interpreters.html) concept allows any language/data-processing-backend to be plugged into Zeppelin.
|
||||
Currently Apache Zeppelin supports many interpreters such as Apache Spark, Python, JDBC, Markdown and Shell.
|
||||
|
||||
<img class="img-responsive" width="500px" style="margin:0 auto; padding: 26px;" src="../assets/themes/zeppelin/img/available_interpreters.png" />
|
||||
<img class="img-responsive" width="500px" style="margin:0 auto; padding: 26px;" src="./assets/themes/zeppelin/img/available_interpreters.png" />
|
||||
|
||||
Adding new language-backend is really simple. Learn [how to create your own interpreter](./development/writingzeppelininterpreter.html#make-your-own-interpreter).
|
||||
|
||||
#### Apache Spark integration
|
||||
Especially, Apache Zeppelin provides built-in [Apache Spark](http://spark.apache.org/) integration. You don't need to build a separate module, plugin or library for it.
|
||||
|
||||
<img class="img-responsive" src="../assets/themes/zeppelin/img/spark_logo.jpg" width="140px" />
|
||||
<img class="img-responsive" src="./assets/themes/zeppelin/img/spark_logo.jpg" width="140px" />
|
||||
|
||||
Apache Zeppelin with Spark integration provides
|
||||
|
||||
|
|
@ -66,10 +66,10 @@ Some basic charts are already included in Apache Zeppelin. Visualizations are no
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<img class="img-responsive" src="../assets/themes/zeppelin/img/graph1.png" />
|
||||
<img class="img-responsive" src="./assets/themes/zeppelin/img/graph1.png" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<img class="img-responsive" src="../assets/themes/zeppelin/img/graph2.png" />
|
||||
<img class="img-responsive" src="./assets/themes/zeppelin/img/graph2.png" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ Apache Zeppelin aggregates values and displays them in pivot chart with simple d
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<img class="img-responsive" style="margin: 16px auto;" src="../assets/themes/zeppelin/img/screenshots/pivot.png" width="480px" />
|
||||
<img class="img-responsive" style="margin: 16px auto;" src="./assets/themes/zeppelin/img/screenshots/pivot.png" width="480px" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ Learn more about [display systems](#display-system) in Apache Zeppelin.
|
|||
Apache Zeppelin can dynamically create some input forms in your notebook.
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<img class="img-responsive" style="margin: 16px auto;" src="../assets/themes/zeppelin/img/screenshots/dynamicform.png" />
|
||||
<img class="img-responsive" style="margin: 16px auto;" src="./assets/themes/zeppelin/img/screenshots/dynamicform.png" />
|
||||
</div>
|
||||
</div>
|
||||
Learn more about [Dynamic Forms](./manual/dynamicform.html).
|
||||
|
|
@ -102,7 +102,7 @@ Your notebook URL can be shared among collaborators. Then Apache Zeppelin will b
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<img class="img-responsive" style="margin: 20px auto" src="../assets/themes/zeppelin/img/screenshots/publish.png" width="650px"/>
|
||||
<img class="img-responsive" style="margin: 20px auto" src="./assets/themes/zeppelin/img/screenshots/publish.png" width="650px"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ If you want to learn more about this feature, please visit [this page](./manual/
|
|||
<br />
|
||||
## 100% Opensource
|
||||
|
||||
<img class="img-responsive" style="margin:0 auto; padding: 15px;" src="../assets/themes/zeppelin/img/asf_logo.png" width="250px"/>
|
||||
<img class="img-responsive" style="margin:0 auto; padding: 15px;" src="./assets/themes/zeppelin/img/asf_logo.png" width="250px"/>
|
||||
|
||||
Apache Zeppelin is Apache2 Licensed software. Please check out the [source repository](http://git.apache.org/zeppelin.git) and [how to contribute](./development/howtocontribute.html).
|
||||
Apache Zeppelin has a very active development community.
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ 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.thrift.InterpreterCompletion;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
|
|
@ -244,8 +245,8 @@ public class ElasticsearchInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String s, int i) {
|
||||
final List<String> suggestions = new ArrayList<>();
|
||||
public List<InterpreterCompletion> completion(String s, int i) {
|
||||
final List suggestions = new ArrayList<>();
|
||||
|
||||
if (StringUtils.isEmpty(s)) {
|
||||
suggestions.addAll(COMMANDS);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Type;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -165,7 +166,7 @@ public abstract class FileInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.apache.commons.lang.StringUtils;
|
|||
import org.apache.zeppelin.interpreter.Interpreter;
|
||||
import org.apache.zeppelin.interpreter.InterpreterException;
|
||||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
|
||||
/**
|
||||
* HDFS implementation of File interpreter for Zeppelin.
|
||||
|
|
@ -259,9 +260,9 @@ public class HDFSFileInterpreter extends FileInterpreter {
|
|||
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
logger.info("Completion request at position\t" + cursor + " in string " + buf);
|
||||
final List<String> suggestions = new ArrayList<>();
|
||||
final List suggestions = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(buf)) {
|
||||
suggestions.add("ls");
|
||||
suggestions.add("cd");
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.InterpreterUtils;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -331,8 +332,8 @@ public class FlinkInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
return new LinkedList<String>();
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
private void startFlinkMiniCluster() {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -300,7 +301,7 @@ public class GeodeOqlInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
package org.apache.zeppelin.hbase;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.jruby.embed.LocalContextScope;
|
||||
|
|
@ -152,7 +153,7 @@ public class HbaseInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
|
|||
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -342,7 +343,7 @@ public class IgniteInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ 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.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -194,7 +195,7 @@ public class IgniteSqlInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.apache.zeppelin.interpreter.Interpreter;
|
|||
import org.apache.zeppelin.interpreter.InterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -113,7 +114,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
}
|
||||
};
|
||||
|
||||
private static final List<String> NO_COMPLETION = new ArrayList<>();
|
||||
private static final List<InterpreterCompletion> NO_COMPLETION = new ArrayList<>();
|
||||
|
||||
public JDBCInterpreter(Properties property) {
|
||||
super(property);
|
||||
|
|
@ -438,11 +439,12 @@ public class JDBCInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
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);
|
||||
List completion = Lists.transform(candidates, sequenceToStringTransformer);
|
||||
return completion;
|
||||
} else {
|
||||
return NO_COMPLETION;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ 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.thrift.InterpreterCompletion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -112,7 +113,7 @@ public class KylinInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -433,7 +434,7 @@ public class LensInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.zeppelin.livy;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -115,7 +116,7 @@ public class LivyPySparkInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.zeppelin.livy;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -143,7 +144,7 @@ public class LivySparkInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.zeppelin.livy;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -115,7 +116,7 @@ public class LivySparkRInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.zeppelin.livy;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -158,7 +159,7 @@ public class LivySparkSQLInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.InterpreterUtils;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.markdown4j.Markdown4jProcessor;
|
||||
|
|
@ -87,7 +88,7 @@ public class Markdown extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -224,7 +225,7 @@ public class PhoenixInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -120,7 +121,7 @@ public class PostgreSqlInterpreter extends Interpreter {
|
|||
}
|
||||
};
|
||||
|
||||
private static final List<String> NO_COMPLETION = new ArrayList<String>();
|
||||
private static final List NO_COMPLETION = new ArrayList<>();
|
||||
|
||||
public PostgreSqlInterpreter(Properties property) {
|
||||
super(property);
|
||||
|
|
@ -321,11 +322,12 @@ public class PostgreSqlInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
|
||||
List<CharSequence> candidates = new ArrayList<CharSequence>();
|
||||
if (sqlCompleter != null && sqlCompleter.complete(buf, cursor, candidates) >= 0) {
|
||||
return Lists.transform(candidates, sequenceToStringTransformer);
|
||||
List completion = Lists.transform(candidates, sequenceToStringTransformer);
|
||||
return completion;
|
||||
} else {
|
||||
return NO_COMPLETION;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Job;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
|
@ -175,7 +176,7 @@ public class PythonInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.zeppelin.rinterpreter;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
@ -82,8 +83,9 @@ public class KnitR extends Interpreter implements WrappedInterpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String s, int i) {
|
||||
return intp.completion(s, i);
|
||||
public List<InterpreterCompletion> completion(String s, int i) {
|
||||
List completion = intp.completion(s, i);
|
||||
return completion;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package org.apache.zeppelin.rinterpreter;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
@ -82,8 +83,9 @@ public class RRepl extends Interpreter implements WrappedInterpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String s, int i) {
|
||||
return intp.completion(s, i);
|
||||
public List<InterpreterCompletion> completion(String s, int i) {
|
||||
List completion = intp.completion(s, i);
|
||||
return completion;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -95,12 +95,12 @@ abstract class RInterpreter(properties : Properties, startSpark : Boolean = true
|
|||
override def getScheduler : Scheduler = rContext.getScheduler
|
||||
|
||||
// TODO: completion is disabled because it could not be tested with current Zeppelin code
|
||||
def completion(buf :String,cursor : Int) : List[String] = Array[String]("").toList
|
||||
/*def completion(buf :String,cursor : Int) : List[String] = Array[String]("").toList
|
||||
|
||||
private[rinterpreter] def hiddenCompletion(buf :String,cursor : Int) : List[String] =
|
||||
rContext.evalS1(s"""
|
||||
|rzeppelin:::.z.completion("$buf", $cursor)
|
||||
""".stripMargin).toList
|
||||
""".stripMargin).toList*/
|
||||
}
|
||||
|
||||
object RInterpreter {
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ class RInterpreterTest extends FlatSpec {
|
|||
|
||||
|
||||
|
||||
it should "have a functional completion function" taggedAs(RTest) in {
|
||||
/* it should "have a functional completion function" taggedAs(RTest) in {
|
||||
val result = rint.hiddenCompletion("hi", 3)
|
||||
result should (contain ("hist"))
|
||||
}
|
||||
}*/
|
||||
|
||||
it should "have a working progress meter" in {
|
||||
rint.getrContext.setProgress(50)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -53,8 +54,8 @@ public class ScaldingInterpreter extends Interpreter {
|
|||
static final String MAX_OPEN_INSTANCES = "max.open.instances";
|
||||
static final String MAX_OPEN_INSTANCES_DEFAULT = "50";
|
||||
|
||||
public static final List<String> NO_COMPLETION =
|
||||
Collections.unmodifiableList(new ArrayList<String>());
|
||||
public static final List NO_COMPLETION =
|
||||
Collections.unmodifiableList(new ArrayList<>());
|
||||
|
||||
static {
|
||||
Interpreter.register(
|
||||
|
|
@ -281,7 +282,7 @@ public class ScaldingInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return NO_COMPLETION;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Job;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
|
@ -150,7 +151,7 @@ public class ShellInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.spark.repl.SparkILoop;
|
||||
import org.apache.spark.repl.SparkIMain;
|
||||
import org.apache.spark.repl.SparkJLineCompletion;
|
||||
|
|
@ -39,6 +39,7 @@ import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.WrappedInterpreter;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.spark.dep.SparkDependencyContext;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -49,6 +50,7 @@ import org.sonatype.aether.resolution.DependencyResolutionException;
|
|||
import scala.Console;
|
||||
import scala.None;
|
||||
import scala.Some;
|
||||
import scala.collection.convert.WrapAsJava$;
|
||||
import scala.tools.nsc.Settings;
|
||||
import scala.tools.nsc.interpreter.Completion.Candidates;
|
||||
import scala.tools.nsc.interpreter.Completion.ScalaCompleter;
|
||||
|
|
@ -242,10 +244,18 @@ public class DepInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
ScalaCompleter c = completor.completer();
|
||||
Candidates ret = c.complete(buf, cursor);
|
||||
return scala.collection.JavaConversions.seqAsJavaList(ret.candidates());
|
||||
|
||||
List<String> candidates = WrapAsJava$.MODULE$.seqAsJavaList(ret.candidates());
|
||||
List<InterpreterCompletion> completions = new LinkedList<InterpreterCompletion>();
|
||||
|
||||
for (String candidate : candidates) {
|
||||
completions.add(new InterpreterCompletion(candidate, candidate));
|
||||
}
|
||||
|
||||
return completions;
|
||||
}
|
||||
|
||||
private List<File> currentClassPath() {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ import org.apache.zeppelin.interpreter.InterpreterResult;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.LazyOpenInterpreter;
|
||||
import org.apache.zeppelin.interpreter.WrappedInterpreter;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.spark.dep.SparkDependencyContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -402,7 +403,7 @@ public class PySparkInterpreter extends Interpreter implements ExecuteResultHand
|
|||
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
if (buf.length() < cursor) {
|
||||
cursor = buf.length();
|
||||
}
|
||||
|
|
@ -413,7 +414,7 @@ public class PySparkInterpreter extends Interpreter implements ExecuteResultHand
|
|||
SparkInterpreter sparkInterpreter = getSparkInterpreter();
|
||||
if (sparkInterpreter.getSparkVersion().isUnsupportedVersion() == false
|
||||
&& pythonscriptRunning == false) {
|
||||
return new LinkedList<String>();
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
pythonInterpretRequest = new PythonInterpretRequest(completionCommand, "");
|
||||
|
|
@ -430,13 +431,13 @@ public class PySparkInterpreter extends Interpreter implements ExecuteResultHand
|
|||
} catch (InterruptedException e) {
|
||||
// not working
|
||||
logger.info("wait drop");
|
||||
return new LinkedList<String>();
|
||||
return new LinkedList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (statementError) {
|
||||
return new LinkedList<String>();
|
||||
return new LinkedList<>();
|
||||
}
|
||||
InterpreterResult completionResult = new InterpreterResult(Code.SUCCESS, statementOutput);
|
||||
//end code for completion
|
||||
|
|
|
|||
|
|
@ -19,10 +19,7 @@ package org.apache.zeppelin.spark;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.*;
|
||||
|
|
@ -30,6 +27,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.spark.HttpServer;
|
||||
import org.apache.spark.SparkConf;
|
||||
import org.apache.spark.SparkContext;
|
||||
|
|
@ -53,6 +52,7 @@ import org.apache.zeppelin.interpreter.InterpreterUtils;
|
|||
import org.apache.zeppelin.interpreter.WrappedInterpreter;
|
||||
import org.apache.zeppelin.resource.ResourcePool;
|
||||
import org.apache.zeppelin.resource.WellKnownResourceName;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.apache.zeppelin.spark.dep.SparkDependencyContext;
|
||||
|
|
@ -65,7 +65,10 @@ import scala.Enumeration.Value;
|
|||
import scala.collection.Iterator;
|
||||
import scala.collection.JavaConversions;
|
||||
import scala.collection.JavaConverters;
|
||||
import scala.collection.convert.WrapAsJava;
|
||||
import scala.collection.Seq;
|
||||
import scala.collection.convert.WrapAsJava$;
|
||||
import scala.collection.convert.WrapAsScala;
|
||||
import scala.collection.mutable.HashMap;
|
||||
import scala.collection.mutable.HashSet;
|
||||
import scala.reflect.io.AbstractFile;
|
||||
|
|
@ -646,7 +649,7 @@ public class SparkInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
if (buf.length() < cursor) {
|
||||
cursor = buf.length();
|
||||
}
|
||||
|
|
@ -657,7 +660,15 @@ public class SparkInterpreter extends Interpreter {
|
|||
}
|
||||
ScalaCompleter c = completor.completer();
|
||||
Candidates ret = c.complete(completionText, cursor);
|
||||
return scala.collection.JavaConversions.seqAsJavaList(ret.candidates());
|
||||
|
||||
List<String> candidates = WrapAsJava$.MODULE$.seqAsJavaList(ret.candidates());
|
||||
List<InterpreterCompletion> completions = new LinkedList<InterpreterCompletion>();
|
||||
|
||||
for (String candidate : candidates) {
|
||||
completions.add(new InterpreterCompletion(candidate, candidate));
|
||||
}
|
||||
|
||||
return completions;
|
||||
}
|
||||
|
||||
private String getCompletionTargetString(String text, int cursor) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.spark.SparkRBackend;
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -166,8 +167,8 @@ public class SparkRInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
return new ArrayList<String>();
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private SparkInterpreter getSparkInterpreter() {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.apache.zeppelin.interpreter.InterpreterResult;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.LazyOpenInterpreter;
|
||||
import org.apache.zeppelin.interpreter.WrappedInterpreter;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -177,7 +178,7 @@ public class SparkSqlInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.net.URL;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
|
||||
/**
|
||||
|
|
@ -151,11 +152,12 @@ public class ClassloaderInterpreter
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
try {
|
||||
return intp.completion(buf, cursor);
|
||||
List completion = intp.completion(buf, cursor);
|
||||
return completion;
|
||||
} catch (Exception e) {
|
||||
throw new InterpreterException(e);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.util.Properties;
|
|||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.zeppelin.annotation.ZeppelinApi;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -106,7 +107,9 @@ public abstract class Interpreter {
|
|||
* @return list of possible completion. Return empty list if there're nothing to return.
|
||||
*/
|
||||
@ZeppelinApi
|
||||
public abstract List<String> completion(String buf, int cursor);
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interpreter can implements it's own scheduler by overriding this method.
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.net.URL;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
|
||||
/**
|
||||
|
|
@ -116,9 +117,10 @@ public class LazyOpenInterpreter
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
open();
|
||||
return intp.completion(buf, cursor);
|
||||
List completion = intp.completion(buf, cursor);
|
||||
return completion;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.apache.zeppelin.interpreter.InterpreterContextRunner;
|
|||
import org.apache.zeppelin.interpreter.InterpreterException;
|
||||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
|
||||
/**
|
||||
* Dummy interpreter to support development mode for Zeppelin app
|
||||
|
|
@ -103,8 +104,8 @@ public class DevInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
return new LinkedList<String>();
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return new LinkedList<InterpreterCompletion>();
|
||||
}
|
||||
|
||||
public InterpreterContext getLastInterpretContext() {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.apache.zeppelin.helium.ApplicationEventListener;
|
|||
import org.apache.zeppelin.display.Input;
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Type;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client;
|
||||
|
|
@ -432,7 +433,7 @@ public class RemoteInterpreter extends Interpreter {
|
|||
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
RemoteInterpreterProcess interpreterProcess = getInterpreterProcess();
|
||||
Client client = null;
|
||||
try {
|
||||
|
|
@ -443,7 +444,8 @@ public class RemoteInterpreter extends Interpreter {
|
|||
|
||||
boolean broken = false;
|
||||
try {
|
||||
return client.completion(noteId, className, buf, cursor);
|
||||
List completion = client.completion(noteId, className, buf, cursor);
|
||||
return completion;
|
||||
} catch (TException e) {
|
||||
broken = true;
|
||||
throw new InterpreterException(e);
|
||||
|
|
|
|||
|
|
@ -455,10 +455,12 @@ public class RemoteInterpreterServer
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String noteId, String className, String buf, int cursor)
|
||||
public List<InterpreterCompletion> completion(String noteId,
|
||||
String className, String buf, int cursor)
|
||||
throws TException {
|
||||
Interpreter intp = getInterpreter(noteId, className);
|
||||
return intp.completion(buf, cursor);
|
||||
List completion = intp.completion(buf, cursor);
|
||||
return completion;
|
||||
}
|
||||
|
||||
private InterpreterContext convert(RemoteInterpreterContext ric) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,520 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.9.2)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package org.apache.zeppelin.interpreter.thrift;
|
||||
|
||||
import org.apache.thrift.scheme.IScheme;
|
||||
import org.apache.thrift.scheme.SchemeFactory;
|
||||
import org.apache.thrift.scheme.StandardScheme;
|
||||
|
||||
import org.apache.thrift.scheme.TupleScheme;
|
||||
import org.apache.thrift.protocol.TTupleProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.async.AsyncMethodCallback;
|
||||
import org.apache.thrift.server.AbstractNonblockingServer.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import javax.annotation.Generated;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-8")
|
||||
public class InterpreterCompletion implements org.apache.thrift.TBase<InterpreterCompletion, InterpreterCompletion._Fields>, java.io.Serializable, Cloneable, Comparable<InterpreterCompletion> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InterpreterCompletion");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
|
||||
private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)2);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
schemes.put(StandardScheme.class, new InterpreterCompletionStandardSchemeFactory());
|
||||
schemes.put(TupleScheme.class, new InterpreterCompletionTupleSchemeFactory());
|
||||
}
|
||||
|
||||
public String name; // required
|
||||
public String value; // required
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
NAME((short)1, "name"),
|
||||
VALUE((short)2, "value");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
switch(fieldId) {
|
||||
case 1: // NAME
|
||||
return NAME;
|
||||
case 2: // VALUE
|
||||
return VALUE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches fieldId, throwing an exception
|
||||
* if it is not found.
|
||||
*/
|
||||
public static _Fields findByThriftIdOrThrow(int fieldId) {
|
||||
_Fields fields = findByThriftId(fieldId);
|
||||
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
|
||||
return fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches name, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByName(String name) {
|
||||
return byName.get(name);
|
||||
}
|
||||
|
||||
private final short _thriftId;
|
||||
private final String _fieldName;
|
||||
|
||||
_Fields(short thriftId, String fieldName) {
|
||||
_thriftId = thriftId;
|
||||
_fieldName = fieldName;
|
||||
}
|
||||
|
||||
public short getThriftFieldId() {
|
||||
return _thriftId;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return _fieldName;
|
||||
}
|
||||
}
|
||||
|
||||
// isset id assignments
|
||||
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||
tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InterpreterCompletion.class, metaDataMap);
|
||||
}
|
||||
|
||||
public InterpreterCompletion() {
|
||||
}
|
||||
|
||||
public InterpreterCompletion(
|
||||
String name,
|
||||
String value)
|
||||
{
|
||||
this();
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public InterpreterCompletion(InterpreterCompletion other) {
|
||||
if (other.isSetName()) {
|
||||
this.name = other.name;
|
||||
}
|
||||
if (other.isSetValue()) {
|
||||
this.value = other.value;
|
||||
}
|
||||
}
|
||||
|
||||
public InterpreterCompletion deepCopy() {
|
||||
return new InterpreterCompletion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.name = null;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public InterpreterCompletion setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetName() {
|
||||
this.name = null;
|
||||
}
|
||||
|
||||
/** Returns true if field name is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetName() {
|
||||
return this.name != null;
|
||||
}
|
||||
|
||||
public void setNameIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.name = null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public InterpreterCompletion setValue(String value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetValue() {
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
/** Returns true if field value is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetValue() {
|
||||
return this.value != null;
|
||||
}
|
||||
|
||||
public void setValueIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case NAME:
|
||||
if (value == null) {
|
||||
unsetName();
|
||||
} else {
|
||||
setName((String)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case VALUE:
|
||||
if (value == null) {
|
||||
unsetValue();
|
||||
} else {
|
||||
setValue((String)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case NAME:
|
||||
return getName();
|
||||
|
||||
case VALUE:
|
||||
return getValue();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case NAME:
|
||||
return isSetName();
|
||||
case VALUE:
|
||||
return isSetValue();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof InterpreterCompletion)
|
||||
return this.equals((InterpreterCompletion)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(InterpreterCompletion that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
|
||||
boolean this_present_name = true && this.isSetName();
|
||||
boolean that_present_name = true && that.isSetName();
|
||||
if (this_present_name || that_present_name) {
|
||||
if (!(this_present_name && that_present_name))
|
||||
return false;
|
||||
if (!this.name.equals(that.name))
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_value = true && this.isSetValue();
|
||||
boolean that_present_value = true && that.isSetValue();
|
||||
if (this_present_value || that_present_value) {
|
||||
if (!(this_present_value && that_present_value))
|
||||
return false;
|
||||
if (!this.value.equals(that.value))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
|
||||
boolean present_name = true && (isSetName());
|
||||
list.add(present_name);
|
||||
if (present_name)
|
||||
list.add(name);
|
||||
|
||||
boolean present_value = true && (isSetValue());
|
||||
list.add(present_value);
|
||||
if (present_value)
|
||||
list.add(value);
|
||||
|
||||
return list.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(InterpreterCompletion other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetName()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetValue()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
|
||||
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
|
||||
}
|
||||
|
||||
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("InterpreterCompletion(");
|
||||
boolean first = true;
|
||||
|
||||
sb.append("name:");
|
||||
if (this.name == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.name);
|
||||
}
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("value:");
|
||||
if (this.value == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.value);
|
||||
}
|
||||
first = false;
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void validate() throws org.apache.thrift.TException {
|
||||
// check for required fields
|
||||
// check for sub-struct validity
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
try {
|
||||
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
|
||||
} catch (org.apache.thrift.TException te) {
|
||||
throw new java.io.IOException(te);
|
||||
}
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
|
||||
try {
|
||||
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
|
||||
} catch (org.apache.thrift.TException te) {
|
||||
throw new java.io.IOException(te);
|
||||
}
|
||||
}
|
||||
|
||||
private static class InterpreterCompletionStandardSchemeFactory implements SchemeFactory {
|
||||
public InterpreterCompletionStandardScheme getScheme() {
|
||||
return new InterpreterCompletionStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class InterpreterCompletionStandardScheme extends StandardScheme<InterpreterCompletion> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, InterpreterCompletion struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TField schemeField;
|
||||
iprot.readStructBegin();
|
||||
while (true)
|
||||
{
|
||||
schemeField = iprot.readFieldBegin();
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
|
||||
break;
|
||||
}
|
||||
switch (schemeField.id) {
|
||||
case 1: // NAME
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
struct.name = iprot.readString();
|
||||
struct.setNameIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 2: // VALUE
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
struct.value = iprot.readString();
|
||||
struct.setValueIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
// check for required fields of primitive type, which can't be checked in the validate method
|
||||
struct.validate();
|
||||
}
|
||||
|
||||
public void write(org.apache.thrift.protocol.TProtocol oprot, InterpreterCompletion struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
if (struct.name != null) {
|
||||
oprot.writeFieldBegin(NAME_FIELD_DESC);
|
||||
oprot.writeString(struct.name);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
if (struct.value != null) {
|
||||
oprot.writeFieldBegin(VALUE_FIELD_DESC);
|
||||
oprot.writeString(struct.value);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class InterpreterCompletionTupleSchemeFactory implements SchemeFactory {
|
||||
public InterpreterCompletionTupleScheme getScheme() {
|
||||
return new InterpreterCompletionTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class InterpreterCompletionTupleScheme extends TupleScheme<InterpreterCompletion> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, InterpreterCompletion struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol oprot = (TTupleProtocol) prot;
|
||||
BitSet optionals = new BitSet();
|
||||
if (struct.isSetName()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
if (struct.isSetValue()) {
|
||||
optionals.set(1);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 2);
|
||||
if (struct.isSetName()) {
|
||||
oprot.writeString(struct.name);
|
||||
}
|
||||
if (struct.isSetValue()) {
|
||||
oprot.writeString(struct.value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, InterpreterCompletion struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol iprot = (TTupleProtocol) prot;
|
||||
BitSet incoming = iprot.readBitSet(2);
|
||||
if (incoming.get(0)) {
|
||||
struct.name = iprot.readString();
|
||||
struct.setNameIsSet(true);
|
||||
}
|
||||
if (incoming.get(1)) {
|
||||
struct.value = iprot.readString();
|
||||
struct.setValueIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-5-7")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-8")
|
||||
public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteInterpreterContext, RemoteInterpreterContext._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterContext> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterContext");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-5-7")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-8")
|
||||
public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInterpreterEvent, RemoteInterpreterEvent._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterEvent> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterEvent");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-5-7")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-8")
|
||||
public class RemoteInterpreterResult implements org.apache.thrift.TBase<RemoteInterpreterResult, RemoteInterpreterResult._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterResult> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterResult");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-5-7")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-8")
|
||||
public class RemoteInterpreterService {
|
||||
|
||||
public interface Iface {
|
||||
|
|
@ -70,7 +70,7 @@ public class RemoteInterpreterService {
|
|||
|
||||
public String getFormType(String noteId, String className) throws org.apache.thrift.TException;
|
||||
|
||||
public List<String> completion(String noteId, String className, String buf, int cursor) throws org.apache.thrift.TException;
|
||||
public List<InterpreterCompletion> completion(String noteId, String className, String buf, int cursor) throws org.apache.thrift.TException;
|
||||
|
||||
public void shutdown() throws org.apache.thrift.TException;
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ public class RemoteInterpreterService {
|
|||
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getFormType failed: unknown result");
|
||||
}
|
||||
|
||||
public List<String> completion(String noteId, String className, String buf, int cursor) throws org.apache.thrift.TException
|
||||
public List<InterpreterCompletion> completion(String noteId, String className, String buf, int cursor) throws org.apache.thrift.TException
|
||||
{
|
||||
send_completion(noteId, className, buf, cursor);
|
||||
return recv_completion();
|
||||
|
|
@ -352,7 +352,7 @@ public class RemoteInterpreterService {
|
|||
sendBase("completion", args);
|
||||
}
|
||||
|
||||
public List<String> recv_completion() throws org.apache.thrift.TException
|
||||
public List<InterpreterCompletion> recv_completion() throws org.apache.thrift.TException
|
||||
{
|
||||
completion_result result = new completion_result();
|
||||
receiveBase(result, "completion");
|
||||
|
|
@ -1012,7 +1012,7 @@ public class RemoteInterpreterService {
|
|||
prot.writeMessageEnd();
|
||||
}
|
||||
|
||||
public List<String> getResult() throws org.apache.thrift.TException {
|
||||
public List<InterpreterCompletion> getResult() throws org.apache.thrift.TException {
|
||||
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
|
||||
throw new IllegalStateException("Method call not finished!");
|
||||
}
|
||||
|
|
@ -2438,7 +2438,7 @@ public class RemoteInterpreterService {
|
|||
}
|
||||
}
|
||||
|
||||
public static class completion<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, completion_args, List<String>> {
|
||||
public static class completion<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, completion_args, List<InterpreterCompletion>> {
|
||||
public completion() {
|
||||
super("completion");
|
||||
}
|
||||
|
|
@ -2447,10 +2447,10 @@ public class RemoteInterpreterService {
|
|||
return new completion_args();
|
||||
}
|
||||
|
||||
public AsyncMethodCallback<List<String>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
|
||||
public AsyncMethodCallback<List<InterpreterCompletion>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
|
||||
final org.apache.thrift.AsyncProcessFunction fcall = this;
|
||||
return new AsyncMethodCallback<List<String>>() {
|
||||
public void onComplete(List<String> o) {
|
||||
return new AsyncMethodCallback<List<InterpreterCompletion>>() {
|
||||
public void onComplete(List<InterpreterCompletion> o) {
|
||||
completion_result result = new completion_result();
|
||||
result.success = o;
|
||||
try {
|
||||
|
|
@ -2484,7 +2484,7 @@ public class RemoteInterpreterService {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void start(I iface, completion_args args, org.apache.thrift.async.AsyncMethodCallback<List<String>> resultHandler) throws TException {
|
||||
public void start(I iface, completion_args args, org.apache.thrift.async.AsyncMethodCallback<List<InterpreterCompletion>> resultHandler) throws TException {
|
||||
iface.completion(args.noteId, args.className, args.buf, args.cursor,resultHandler);
|
||||
}
|
||||
}
|
||||
|
|
@ -9974,7 +9974,7 @@ public class RemoteInterpreterService {
|
|||
schemes.put(TupleScheme.class, new completion_resultTupleSchemeFactory());
|
||||
}
|
||||
|
||||
public List<String> success; // required
|
||||
public List<InterpreterCompletion> success; // required
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
|
|
@ -10040,7 +10040,7 @@ public class RemoteInterpreterService {
|
|||
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, InterpreterCompletion.class))));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(completion_result.class, metaDataMap);
|
||||
}
|
||||
|
|
@ -10049,7 +10049,7 @@ public class RemoteInterpreterService {
|
|||
}
|
||||
|
||||
public completion_result(
|
||||
List<String> success)
|
||||
List<InterpreterCompletion> success)
|
||||
{
|
||||
this();
|
||||
this.success = success;
|
||||
|
|
@ -10060,7 +10060,10 @@ public class RemoteInterpreterService {
|
|||
*/
|
||||
public completion_result(completion_result other) {
|
||||
if (other.isSetSuccess()) {
|
||||
List<String> __this__success = new ArrayList<String>(other.success);
|
||||
List<InterpreterCompletion> __this__success = new ArrayList<InterpreterCompletion>(other.success.size());
|
||||
for (InterpreterCompletion other_element : other.success) {
|
||||
__this__success.add(new InterpreterCompletion(other_element));
|
||||
}
|
||||
this.success = __this__success;
|
||||
}
|
||||
}
|
||||
|
|
@ -10078,22 +10081,22 @@ public class RemoteInterpreterService {
|
|||
return (this.success == null) ? 0 : this.success.size();
|
||||
}
|
||||
|
||||
public java.util.Iterator<String> getSuccessIterator() {
|
||||
public java.util.Iterator<InterpreterCompletion> getSuccessIterator() {
|
||||
return (this.success == null) ? null : this.success.iterator();
|
||||
}
|
||||
|
||||
public void addToSuccess(String elem) {
|
||||
public void addToSuccess(InterpreterCompletion elem) {
|
||||
if (this.success == null) {
|
||||
this.success = new ArrayList<String>();
|
||||
this.success = new ArrayList<InterpreterCompletion>();
|
||||
}
|
||||
this.success.add(elem);
|
||||
}
|
||||
|
||||
public List<String> getSuccess() {
|
||||
public List<InterpreterCompletion> getSuccess() {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
public completion_result setSuccess(List<String> success) {
|
||||
public completion_result setSuccess(List<InterpreterCompletion> success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -10119,7 +10122,7 @@ public class RemoteInterpreterService {
|
|||
if (value == null) {
|
||||
unsetSuccess();
|
||||
} else {
|
||||
setSuccess((List<String>)value);
|
||||
setSuccess((List<InterpreterCompletion>)value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -10277,11 +10280,12 @@ public class RemoteInterpreterService {
|
|||
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list10 = iprot.readListBegin();
|
||||
struct.success = new ArrayList<String>(_list10.size);
|
||||
String _elem11;
|
||||
struct.success = new ArrayList<InterpreterCompletion>(_list10.size);
|
||||
InterpreterCompletion _elem11;
|
||||
for (int _i12 = 0; _i12 < _list10.size; ++_i12)
|
||||
{
|
||||
_elem11 = iprot.readString();
|
||||
_elem11 = new InterpreterCompletion();
|
||||
_elem11.read(iprot);
|
||||
struct.success.add(_elem11);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
|
|
@ -10309,10 +10313,10 @@ public class RemoteInterpreterService {
|
|||
if (struct.success != null) {
|
||||
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size()));
|
||||
for (String _iter13 : struct.success)
|
||||
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
|
||||
for (InterpreterCompletion _iter13 : struct.success)
|
||||
{
|
||||
oprot.writeString(_iter13);
|
||||
_iter13.write(oprot);
|
||||
}
|
||||
oprot.writeListEnd();
|
||||
}
|
||||
|
|
@ -10343,9 +10347,9 @@ public class RemoteInterpreterService {
|
|||
if (struct.isSetSuccess()) {
|
||||
{
|
||||
oprot.writeI32(struct.success.size());
|
||||
for (String _iter14 : struct.success)
|
||||
for (InterpreterCompletion _iter14 : struct.success)
|
||||
{
|
||||
oprot.writeString(_iter14);
|
||||
_iter14.write(oprot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10357,12 +10361,13 @@ public class RemoteInterpreterService {
|
|||
BitSet incoming = iprot.readBitSet(1);
|
||||
if (incoming.get(0)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list15 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.success = new ArrayList<String>(_list15.size);
|
||||
String _elem16;
|
||||
org.apache.thrift.protocol.TList _list15 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.success = new ArrayList<InterpreterCompletion>(_list15.size);
|
||||
InterpreterCompletion _elem16;
|
||||
for (int _i17 = 0; _i17 < _list15.size; ++_i17)
|
||||
{
|
||||
_elem16 = iprot.readString();
|
||||
_elem16 = new InterpreterCompletion();
|
||||
_elem16.read(iprot);
|
||||
struct.success.add(_elem16);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,17 @@ struct RemoteApplicationResult {
|
|||
2: string msg
|
||||
}
|
||||
|
||||
/*
|
||||
* The below variables(name, value) will be connected to getCompletions in paragraph.controller.js
|
||||
*
|
||||
* name: which is shown in the suggestion list
|
||||
* value: actual return value what you selected
|
||||
*/
|
||||
struct InterpreterCompletion {
|
||||
1: string name,
|
||||
2: string value
|
||||
}
|
||||
|
||||
service RemoteInterpreterService {
|
||||
void createInterpreter(1: string intpGroupId, 2: string noteId, 3: string className, 4: map<string, string> properties);
|
||||
|
||||
|
|
@ -71,7 +82,7 @@ service RemoteInterpreterService {
|
|||
void cancel(1: string noteId, 2: string className, 3: RemoteInterpreterContext interpreterContext);
|
||||
i32 getProgress(1: string noteId, 2: string className, 3: RemoteInterpreterContext interpreterContext);
|
||||
string getFormType(1: string noteId, 2: string className);
|
||||
list<string> completion(1: string noteId, 2: string className, 3: string buf, 4: i32 cursor);
|
||||
list<InterpreterCompletion> completion(1: string noteId, 2: string className, 3: string buf, 4: i32 cursor);
|
||||
void shutdown();
|
||||
|
||||
string getStatus(1: string noteId, 2:string jobId);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ 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.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ public class MockInterpreterA extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
|
||||
public class MockInterpreterAngular extends Interpreter {
|
||||
static {
|
||||
|
|
@ -114,7 +115,7 @@ public class MockInterpreterAngular extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.WrappedInterpreter;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
|
||||
public class MockInterpreterB extends Interpreter {
|
||||
|
|
@ -85,7 +86,7 @@ public class MockInterpreterB extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.zeppelin.interpreter.remote.mock;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
||||
|
|
@ -75,7 +76,7 @@ public class MockInterpreterEnv extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.zeppelin.interpreter.remote.mock;
|
||||
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ public class MockInterpreterOutputStream extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext;
|
|||
import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.resource.Resource;
|
||||
import org.apache.zeppelin.resource.ResourcePool;
|
||||
|
||||
|
|
@ -121,7 +122,7 @@ public class MockInterpreterResourcePool extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ import org.apache.zeppelin.helium.ApplicationEventListener;
|
|||
import org.apache.zeppelin.helium.HeliumPackage;
|
||||
import org.apache.zeppelin.interpreter.InterpreterGroup;
|
||||
import org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.user.AuthenticationInfo;
|
||||
import org.apache.zeppelin.interpreter.InterpreterOutput;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
|
|
@ -709,7 +710,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
}
|
||||
|
||||
final Note note = notebook.getNote(getOpenNoteId(conn));
|
||||
List<String> candidates = note.completion(paragraphId, buffer, cursor);
|
||||
List<InterpreterCompletion> candidates = note.completion(paragraphId, buffer, cursor);
|
||||
resp.put("completions", candidates);
|
||||
conn.send(serializeMessage(resp));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,8 +167,8 @@ public class SparkParagraphIT extends AbstractZeppelinIT {
|
|||
WebElement paragraph1Result = driver.findElement(By.xpath(
|
||||
getParagraphXPath(1) + "//div[@class=\"tableDisplay\"]/div/div/div"));
|
||||
collector.checkThat("Paragraph from SparkParagraphIT of testSqlSpark result: ",
|
||||
paragraph1Result.getText().toString(), CoreMatchers.equalTo("age\njob\nmarital\neducation\nbalance\n30" +
|
||||
" unemployed married primary 1,787\nage\njob\nmarital\neducation\nbalance"));
|
||||
paragraph1Result.getText().toString(), CoreMatchers.equalTo("age\njob\nmarital\neducation\nbalance\n" +
|
||||
"30 unemployed married primary 1,787"));
|
||||
} catch (Exception e) {
|
||||
handleException("Exception in SparkParagraphIT while testSqlSpark", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.Properties;
|
|||
import org.apache.zeppelin.interpreter.Interpreter;
|
||||
import org.apache.zeppelin.interpreter.InterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
||||
|
|
@ -67,7 +68,7 @@ public class MockInterpreter1 extends Interpreter{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
ng-if="(paragraph.result.type == 'TABLE' || apps.length > 0 || suggestion.available && suggestion.available.length > 0) && !asIframe && !viewOnly"
|
||||
class="btn-group"
|
||||
style='margin-bottom: 10px;'>
|
||||
|
||||
<button type="button" class="btn btn-default btn-sm"
|
||||
ng-if="paragraph.result.type == 'TABLE'"
|
||||
ng-class="{'active': isGraphMode('table')}"
|
||||
|
|
@ -62,11 +63,23 @@ 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>
|
||||
|
||||
<span class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-sm"
|
||||
style="margin-left:10px"
|
||||
ng-click="exportToDSV(',')"
|
||||
tooltip="Download Data as CSV" tooltip-placement="bottom">
|
||||
<i class="fa fa-download"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm dropdown-toggle caretBtn"
|
||||
data-toggle="dropdown">
|
||||
<span class="caret" style="margin: 0px;"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu" style="min-width: 70px;">
|
||||
<li ng-click="exportToDSV(',')"><a>CSV</a></li>
|
||||
<li ng-click="exportToDSV('\t')"><a>TSV</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -847,9 +847,9 @@ angular.module('zeppelinWebApp')
|
|||
for (var c in data.completions) {
|
||||
var v = data.completions[c];
|
||||
completions.push({
|
||||
name:v,
|
||||
value:v,
|
||||
score:300
|
||||
name: v.name,
|
||||
value: v.value,
|
||||
score: 300
|
||||
});
|
||||
}
|
||||
callback(null, completions);
|
||||
|
|
@ -2212,22 +2212,28 @@ angular.module('zeppelinWebApp')
|
|||
$scope.keepScrollDown = false;
|
||||
};
|
||||
|
||||
$scope.exportToTSV = function () {
|
||||
$scope.exportToDSV = function (delimiter) {
|
||||
var data = $scope.paragraph.result;
|
||||
var tsv = '';
|
||||
var dsv = '';
|
||||
for (var titleIndex in $scope.paragraph.result.columnNames) {
|
||||
tsv += $scope.paragraph.result.columnNames[titleIndex].name + '\t';
|
||||
dsv += $scope.paragraph.result.columnNames[titleIndex].name + delimiter;
|
||||
}
|
||||
tsv = tsv.substring(0, tsv.length - 1) + '\n';
|
||||
dsv = dsv.substring(0, dsv.length - 1) + '\n';
|
||||
for (var r in $scope.paragraph.result.msgTable) {
|
||||
var row = $scope.paragraph.result.msgTable[r];
|
||||
var tsvRow = '';
|
||||
var dsvRow = '';
|
||||
for (var index in row) {
|
||||
tsvRow += row[index].value + '\t';
|
||||
dsvRow += row[index].value + delimiter;
|
||||
}
|
||||
tsv += tsvRow.substring(0, tsvRow.length - 1) + '\n';
|
||||
dsv += dsvRow.substring(0, dsvRow.length - 1) + '\n';
|
||||
}
|
||||
SaveAsService.SaveAs(tsv, 'data', 'tsv');
|
||||
var extension = '';
|
||||
if (delimiter === '\t') {
|
||||
extension = 'tsv';
|
||||
} else if (delimiter === ',') {
|
||||
extension = 'csv';
|
||||
}
|
||||
SaveAsService.SaveAs(dsv, 'data', extension);
|
||||
};
|
||||
|
||||
// Helium ---------------------------------------------
|
||||
|
|
|
|||
|
|
@ -449,10 +449,6 @@ table.dataTable.table-condensed .sorting_desc:after {
|
|||
font-weight: 500;
|
||||
}
|
||||
|
||||
.dropdown-menu > li:first-child > a:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
table.table-striped {
|
||||
border-top: 1px solid #ddd;
|
||||
margin-top: 20px;
|
||||
|
|
@ -464,7 +460,6 @@ table.table-striped {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.scroll-paragraph-up {
|
||||
bottom: 5px;
|
||||
cursor: pointer;
|
||||
|
|
@ -476,3 +471,10 @@ table.table-striped {
|
|||
width: 200px;
|
||||
padding: 5px 10px 5px 10px;
|
||||
}
|
||||
|
||||
/* DSV download toggle button */
|
||||
.caretBtn {
|
||||
padding-right: 4px !important;
|
||||
padding-left: 4px !important;
|
||||
width: 20px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.apache.zeppelin.display.Input;
|
|||
import org.apache.zeppelin.helium.HeliumApplicationFactory;
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.notebook.repo.NotebookRepo;
|
||||
import org.apache.zeppelin.notebook.utility.IdHashes;
|
||||
import org.apache.zeppelin.resource.ResourcePoolUtils;
|
||||
|
|
@ -444,11 +445,13 @@ public class Note implements Serializable, ParagraphJobListener {
|
|||
}
|
||||
}
|
||||
|
||||
public List<String> completion(String paragraphId, String buffer, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String paragraphId, String buffer, int cursor) {
|
||||
Paragraph p = getParagraph(paragraphId);
|
||||
p.setNoteReplLoader(replLoader);
|
||||
p.setListener(jobListenerFactory.getParagraphJobListener(this));
|
||||
return p.completion(buffer, cursor);
|
||||
List completion = p.completion(buffer, cursor);
|
||||
|
||||
return completion;
|
||||
}
|
||||
|
||||
public List<Paragraph> getParagraphs() {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.apache.zeppelin.notebook;
|
|||
import org.apache.zeppelin.display.AngularObject;
|
||||
import org.apache.zeppelin.display.AngularObjectRegistry;
|
||||
import org.apache.zeppelin.helium.HeliumPackage;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.user.AuthenticationInfo;
|
||||
import org.apache.zeppelin.user.Credentials;
|
||||
import org.apache.zeppelin.user.UserCredentials;
|
||||
|
|
@ -214,7 +215,7 @@ public class Paragraph extends Job implements Serializable, Cloneable {
|
|||
return getRepl(getRequiredReplName());
|
||||
}
|
||||
|
||||
public List<String> completion(String buffer, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buffer, int cursor) {
|
||||
String replName = getRequiredReplName(buffer);
|
||||
if (replName != null) {
|
||||
cursor -= replName.length() + 1;
|
||||
|
|
@ -225,7 +226,8 @@ public class Paragraph extends Job implements Serializable, Cloneable {
|
|||
return null;
|
||||
}
|
||||
|
||||
return repl.completion(body, cursor);
|
||||
List completion = repl.completion(body, cursor);
|
||||
return completion;
|
||||
}
|
||||
|
||||
public void setNoteReplLoader(NoteInterpreterLoader repls) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.util.Properties;
|
|||
import org.apache.zeppelin.interpreter.Interpreter;
|
||||
import org.apache.zeppelin.interpreter.InterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
||||
|
|
@ -81,7 +82,7 @@ public InterpreterResult interpret(String st, InterpreterContext context) {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.util.Properties;
|
|||
import org.apache.zeppelin.interpreter.Interpreter;
|
||||
import org.apache.zeppelin.interpreter.InterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ public class MockInterpreter11 extends Interpreter{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.util.Properties;
|
|||
import org.apache.zeppelin.interpreter.Interpreter;
|
||||
import org.apache.zeppelin.interpreter.InterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
import org.apache.zeppelin.scheduler.Scheduler;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ public class MockInterpreter2 extends Interpreter{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue