-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ZEPPELIN-982] Improve interpreter completion API #984
Conversation
@@ -416,10 +413,12 @@ public String getFormType(String noteId, String className) throws TException { | |||
} | |||
|
|||
@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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please turn off vertical alignment? If you are using Intellij, you can turn it off where 'Editor' -> 'Code Style' -> 'java' -> 'Wrapping and Braces' -> 'Method declaration parameters' -> 'Align when multiline'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I did as you said and repushed. If I did wrong, please let me know :)
The reason why I did like this is this line is over 100 line length. So I cut this line on purpose.
@AhyoungRyu What the |
public List<InterpreterCompletion> completion(String noteId, String className, String buf, | ||
int cursor) | ||
public List<InterpreterCompletion> completion(String noteId, | ||
String className, String buf, int cursor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AhyoungRyu Zeppelin follows google code style. See https://google.github.io/styleguide/javaguide.html#s4.5.2-line-wrapping-indent
@jongyoul Makes sense. I addressed your feedback. Please see my last two commit :) Regarding |
@AhyoungRyu I see. Thanks. |
@AhyoungRyu there are 2 different test failures on CI here: Integration test fails https://s3.amazonaws.com/archive.travis-ci.org/jobs/137185986/log.txt
Cassandra interpreter test failure https://api.travis-ci.org/jobs/137185978/log.txt?deansi=true
If you believe neither of them are related to this changes - the best way to handle it is to file a JIRA issues (with the name of the test failing in the title), label |
@@ -56,6 +56,11 @@ struct RemoteInterpreterEvent { | |||
2: string data // json serialized data | |||
} | |||
|
|||
struct InterpreterCompletion { | |||
1: string name, | |||
2: string value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They PR is huge so sorry if I have missed it, but could you please point to the place where this API is used?
Right now, looking at this it is not clear what exactly is name
and value
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bzz Regarding the two value name
and value
, can this comment be an answer for your question ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should add a link to this comment inside the source code then?
Because the next person reading it will have exactly the same question as two others had here before.
Or how do you think, is there a way we could improve things here, without referencing legacy naming from the frontend code?
I.e ones the come to my mind and seems reasonable for a completion suggestion to have are:
text
andcode
orvisible_suggestion
andsource_code
- etc
@bzz Yeah thanks for pointing it. I'll take a look at it and the conflictions too. |
1: string name, | ||
2: string value | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bzz I added some descriptions instead of changing overall variable names. Since name
& value
is already existed variable name in paragraph.controll.js
.
Thanks @AhyoungRyu for the improvement and taking care of comments. LGTM. Merge it into master and 0.6 branch if there're no more discussions. |
### What is this PR for? When people implement a new interpreter, they extend [interpreter.java](https://github.com/apache/zeppelin/blob/master/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java) as described in [here](https://zeppelin.apache.org/docs/0.6.0-SNAPSHOT/development/writingzeppelininterpreter.html). Among the several methods in [interpreter.java](https://github.com/apache/zeppelin/blob/master/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java), [completion API](https://github.com/apache/zeppelin/blob/master/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java#L109) enables auto-completion. However this API is too simple compared to other project's auto-completion and hard to add more at the moment. So for the aspect of further expansion, it would be better to separate and restructure this API before the this release( 0.6.0 ). ### What type of PR is it? Improvement ### Todos * [x] - Create new structure : `InterpreterCompletion` in `RemoteInterpreterService.thrift` and regenerate `zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/*` files * [x] - Change all existing `List<String> completion` -> `List<InterpreterCompletion> completion` * [x] - Change `paragraph.controller.js` to point real `name` and `value` ### What is the Jira issue? [ZEPPELIN-982](https://issues.apache.org/jira/browse/ZEPPELIN-982) ### How should this be tested? Since this improvement is just API change, it should work same as before. So after applying this patch, and check whether auto-completion works well or not. Use `. + ctrl` for auto-completion. For example, ``` %spark sc.version ``` When after typing `sc.` and pushing `. + ctrl` down, `version` should be shown in the auto-completion list. ### Screenshots (if appropriate) ![auto_completion](https://cloud.githubusercontent.com/assets/10060731/15952521/72937782-2e76-11e6-8246-4faf0dd77a5b.gif) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: AhyoungRyu <[email protected]> Closes #984 from AhyoungRyu/ZEPPELIN-982 and squashes the following commits: 311dc29 [AhyoungRyu] Fix travis 9d384ec [AhyoungRyu] Address @minalee feedback fdfae8f [AhyoungRyu] Address @jongyoul review bd4f8c0 [AhyoungRyu] Remove abstract and make it return null by default f8352c7 [AhyoungRyu] Fix travis error 43d81f6 [AhyoungRyu] Remove console.log 24912fa [AhyoungRyu] Fix type casting error in SparkInterpreter 80e295b [AhyoungRyu] Change return type bd04c22 [AhyoungRyu] Apply new InterpreterCompletion class to all interpreter class files c283043 [AhyoungRyu] Apply new InterpreterCompletion class under zeppelin-zengine/ dbecc51 [AhyoungRyu] Apply new InterpreterCompletion class under zeppelin-server/ 6449455 [AhyoungRyu] Apply new InterpreterCompletion class under zeppelin-interpreter/ 919b159 [AhyoungRyu] Add automatically generated thrift class 9e69e11 [AhyoungRyu] Change v -> v.name & v.value in front 73e374e [AhyoungRyu] Define InterpreterCompletion structure to thrift file (cherry picked from commit 7b00dff) Signed-off-by: Lee moon soo <[email protected]>
What is this PR for?
When people implement a new interpreter, they extend interpreter.java as described in here. Among the several methods in interpreter.java, completion API enables auto-completion.
However this API is too simple compared to other project's auto-completion and hard to add more at the moment. So for the aspect of further expansion, it would be better to separate and restructure this API before the this release( 0.6.0 ).
What type of PR is it?
Improvement
Todos
InterpreterCompletion
inRemoteInterpreterService.thrift
and regeneratezeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/*
filesList<String> completion
->List<InterpreterCompletion> completion
paragraph.controller.js
to point realname
andvalue
What is the Jira issue?
ZEPPELIN-982
How should this be tested?
Since this improvement is just API change, it should work same as before. So after applying this patch, and check whether auto-completion works well or not.
Use
. + ctrl
for auto-completion. For example,When after typing
sc.
and pushing. + ctrl
down,version
should be shown in the auto-completion list.Screenshots (if appropriate)
Questions: