Repository: zeppelin Updated Branches: refs/heads/master 048e432a6 -> 7b00dffd9
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java index 7ed20f6..1af0ce0 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java @@ -1,4 +1,21 @@ /** + * 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 @@ -34,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-3-17") +@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"); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java index 3f26b79..0c1385f 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java @@ -1,4 +1,21 @@ /** + * 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 @@ -34,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-3-17") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-8") public class RemoteInterpreterService { public interface Iface { @@ -53,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; @@ -307,7 +324,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(); @@ -323,7 +340,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"); @@ -911,7 +928,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!"); } @@ -2166,7 +2183,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"); } @@ -2175,10 +2192,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 { @@ -2212,7 +2229,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); } } @@ -9549,7 +9566,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 { @@ -9615,7 +9632,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); } @@ -9624,7 +9641,7 @@ public class RemoteInterpreterService { } public completion_result( - List<String> success) + List<InterpreterCompletion> success) { this(); this.success = success; @@ -9635,7 +9652,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; } } @@ -9653,22 +9673,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; } @@ -9694,7 +9714,7 @@ public class RemoteInterpreterService { if (value == null) { unsetSuccess(); } else { - setSuccess((List<String>)value); + setSuccess((List<InterpreterCompletion>)value); } break; @@ -9852,11 +9872,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(); @@ -9884,10 +9905,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(); } @@ -9918,9 +9939,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); } } } @@ -9932,12 +9953,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); } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift index 80212e7..6c3fc36 100644 --- a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift +++ b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift @@ -56,6 +56,17 @@ struct RemoteInterpreterEvent { 2: string data // json serialized data } +/* + * 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); @@ -65,7 +76,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); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java index 51f3c2c..cb367ca 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java @@ -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; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterAngular.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterAngular.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterAngular.java index 2f448f2..76b2925 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterAngular.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterAngular.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java index fa6ff7e..d31a549 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java @@ -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; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterEnv.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterEnv.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterEnv.java index bc71acc..10146b8 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterEnv.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterEnv.java @@ -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; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterOutputStream.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterOutputStream.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterOutputStream.java index bc1859f..85a8444 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterOutputStream.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterOutputStream.java @@ -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; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java index 3826b90..e49306d 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java @@ -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; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java index a94fefa..dc190d1 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java @@ -36,6 +36,7 @@ import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.AngularObjectRegistryListener; 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; @@ -707,7 +708,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)); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java index b76a8b2..5ff3bf0 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 4463580..dfdad30 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -792,9 +792,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); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java index d2feb04..01d625a 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java @@ -31,6 +31,7 @@ import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.Input; 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; @@ -427,11 +428,13 @@ public class Note implements Serializable, JobListener { } } - 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() { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java index 86af539..4e02fb1 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java @@ -19,6 +19,7 @@ package org.apache.zeppelin.notebook; import org.apache.zeppelin.display.AngularObject; import org.apache.zeppelin.display.AngularObjectRegistry; +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; @@ -205,7 +206,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; @@ -216,7 +217,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) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java index cf0a613..1b0ec1a 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java @@ -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 class MockInterpreter1 extends Interpreter{ } @Override - public List<String> completion(String buf, int cursor) { + public List<InterpreterCompletion> completion(String buf, int cursor) { return null; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter11.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter11.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter11.java index 89901e5..fd1e4f6 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter11.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter11.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b00dffd/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java index bae4b8d..0fe3a16 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java @@ -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; } }
