Repository: zeppelin Updated Branches: refs/heads/master 89d63da59 -> e740efbe0
ZEPPELIN-3697. Remove interpreter completion for magic part ### What is this PR for? Trivial PR to remove interpreter completion for magic part. Code completion is sufficient for users, I don't think user use code completion for magic part (repl name). ### What type of PR is it? [ Refactoring] ### Todos * [ ] - Task ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3697 ### How should this be tested? * CI pass ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jeff Zhang <zjf...@apache.org> Closes #3120 from zjffdu/ZEPPELIN-3697 and squashes the following commits: a488dc7b9 [Jeff Zhang] ZEPPELIN-3697. Remove interpreter completion for magic part Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/e740efbe Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/e740efbe Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/e740efbe Branch: refs/heads/master Commit: e740efbe0eacd1392f44151808ec1959bc69e3c1 Parents: 89d63da Author: Jeff Zhang <zjf...@apache.org> Authored: Thu Aug 9 15:27:55 2018 +0800 Committer: Jeff Zhang <zjf...@apache.org> Committed: Fri Aug 10 14:43:33 2018 +0800 ---------------------------------------------------------------------- .../java/org/apache/zeppelin/notebook/Note.java | 23 +------------------- .../org/apache/zeppelin/notebook/Paragraph.java | 9 +------- 2 files changed, 2 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e740efbe/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 665f9f3..6a23b64 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 @@ -722,23 +722,6 @@ public class Note implements ParagraphJobListener, JsonSerializable { return p.completion(buffer, cursor); } - public List<InterpreterCompletion> getInterpreterCompletion() { - List<InterpreterCompletion> completion = new LinkedList(); - for (InterpreterSetting intp : interpreterSettingManager.getInterpreterSettings(getId())) { - List<InterpreterInfo> intInfo = intp.getInterpreterInfos(); - if (intInfo.size() > 1) { - for (InterpreterInfo info : intInfo) { - String name = intp.getName() + "." + info.getName(); - completion.add(new InterpreterCompletion(name, name, CompletionType.setting.name())); - } - } else { - completion.add(new InterpreterCompletion(intp.getName(), intp.getName(), - CompletionType.setting.name())); - } - } - return completion; - } - public List<Paragraph> getParagraphs() { synchronized (paragraphs) { return new LinkedList<>(paragraphs); @@ -752,7 +735,7 @@ public class Note implements ParagraphJobListener, JsonSerializable { if (settings == null || settings.size() == 0) { return; } - + for (InterpreterSetting setting : settings) { InterpreterGroup intpGroup = setting.getInterpreterGroup(user, id); if (intpGroup != null) { @@ -958,10 +941,6 @@ public class Note implements ParagraphJobListener, JsonSerializable { this.noteEventListener = noteEventListener; } - boolean hasInterpreterBinded() { - return !interpreterSettingManager.getInterpreterSettings(getId()).isEmpty(); - } - @Override public String toJson() { return gson.toJson(this); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e740efbe/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 1d25088..0e0fa0c 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 @@ -279,13 +279,6 @@ public class Paragraph extends Job implements Cloneable, JsonSerializable { } public List<InterpreterCompletion> completion(String buffer, int cursor) { - String lines[] = buffer.split(System.getProperty("line.separator")); - if (lines.length > 0 && lines[0].startsWith("%") && cursor <= lines[0].trim().length()) { - int idx = lines[0].indexOf(' '); - if (idx < 0 || (idx > 0 && cursor <= idx)) { - return note.getInterpreterCompletion(); - } - } try { this.interpreter = getBindedInterpreter(); } catch (InterpreterNotFoundException e) { @@ -421,7 +414,7 @@ public class Paragraph extends Job implements Cloneable, JsonSerializable { if (interpreterSetting != null) { interpreterSetting.waitForReady(); } - if (this.hasUser() && this.note.hasInterpreterBinded()) { + if (this.hasUser()) { if (interpreterSetting != null && interpreterHasUser(interpreterSetting) && isUserAuthorizedToAccessInterpreter(interpreterSetting.getOption()) == false) { logger.error("{} has no permission for {} ", authenticationInfo.getUser(), intpText);