Repository: zeppelin Updated Branches: refs/heads/master 51b87927b -> fe3dbdb1c
[ZEPPELIN-1366] Removed legacy JDBC alias ### What is this PR for? Removing old JDBC sugar ### What type of PR is it? [Feature] ### Todos * [x] - Removed codes to check jdbc alias enabled ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-1366 ### How should this be tested? * No longer available * `%jdbc(mysql)` -> `%mysql` ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? Yes * Does this needs documentation? Yes, but I don't know where the proper location is. Author: Jongyoul Lee <jongy...@gmail.com> Closes #1360 from jongyoul/ZEPPELIN-1366 and squashes the following commits: f9df86e [Jongyoul Lee] Changed description 302825c [Jongyoul Lee] Removed effectiveText and related test 929bad2 [Jongyoul Lee] Updated docs for breaking changes e52521f [Jongyoul Lee] Removed test for jdbc sugar 9f46bbd [Jongyoul Lee] Resolved codes conflicted Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/fe3dbdb1 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/fe3dbdb1 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/fe3dbdb1 Branch: refs/heads/master Commit: fe3dbdb1cb4c86877697736a05d685e1c27a5856 Parents: 51b8792 Author: Jongyoul Lee <jongy...@gmail.com> Authored: Wed Aug 31 16:29:04 2016 +0900 Committer: Jongyoul Lee <jongy...@apache.org> Committed: Fri Sep 2 11:02:53 2016 +0900 ---------------------------------------------------------------------- docs/install/upgrade.md | 3 +- .../zeppelin/conf/ZeppelinConfiguration.java | 8 +---- .../java/org/apache/zeppelin/notebook/Note.java | 34 +++++++------------- .../org/apache/zeppelin/notebook/Paragraph.java | 14 ++------ .../org/apache/zeppelin/notebook/NoteTest.java | 21 ------------ .../apache/zeppelin/notebook/ParagraphTest.java | 26 --------------- 6 files changed, 16 insertions(+), 90 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fe3dbdb1/docs/install/upgrade.md ---------------------------------------------------------------------- diff --git a/docs/install/upgrade.md b/docs/install/upgrade.md index 16e96e8..60a8f88 100644 --- a/docs/install/upgrade.md +++ b/docs/install/upgrade.md @@ -49,4 +49,5 @@ So, copying `notebook` and `conf` directory should be enough. ### Upgrading from Zeppelin 0.6 to 0.7 - - From 0.7, we don't use `ZEPPELIN_JAVA_OPTS` as default value of `ZEPPELIN_INTP_JAVA_OPTS` and also the same for `ZEPPELIN_MEM`/`ZEPPELIN_INTP_MEM`. If user want to configure the jvm opts of interpreter process, please set `ZEPPELIN_INTP_JAVA_OPTS` and `ZEPPELIN_INTP_MEM` explicitly. \ No newline at end of file + - From 0.7, we don't use `ZEPPELIN_JAVA_OPTS` as default value of `ZEPPELIN_INTP_JAVA_OPTS` and also the same for `ZEPPELIN_MEM`/`ZEPPELIN_INTP_MEM`. If user want to configure the jvm opts of interpreter process, please set `ZEPPELIN_INTP_JAVA_OPTS` and `ZEPPELIN_INTP_MEM` explicitly. + - Mapping from `%jdbc(prefix)` to `%prefix` is no longer available. Instead, you can use %[interpreter alias] with multiple interpreter setttings on GUI. http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fe3dbdb1/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index d146a25..d4f3186 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -427,10 +427,6 @@ public class ZeppelinConfiguration extends XMLConfiguration { return getString(ConfVars.ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE); } - public boolean getUseJdbcAlias() { - return getBoolean(ConfVars.ZEPPELIN_USE_JDBC_ALIAS); - } - public Map<String, String> dumpConfigurations(ZeppelinConfiguration conf, ConfigurationKeyPredicate predicate) { Map<String, String> configurations = new HashMap<>(); @@ -557,9 +553,7 @@ public class ZeppelinConfiguration extends XMLConfiguration { ZEPPELIN_ALLOWED_ORIGINS("zeppelin.server.allowed.origins", "*"), ZEPPELIN_ANONYMOUS_ALLOWED("zeppelin.anonymous.allowed", true), ZEPPELIN_CREDENTIALS_PERSIST("zeppelin.credentials.persist", true), - ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE("zeppelin.websocket.max.text.message.size", "1024000"), - ZEPPELIN_USE_JDBC_ALIAS("zeppelin.use.jdbc.alias", true); - + ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE("zeppelin.websocket.max.text.message.size", "1024000"); private String varName; @SuppressWarnings("rawtypes") http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fe3dbdb1/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 0b2b4c6..5f0f7c1 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 @@ -374,8 +374,8 @@ public class Note implements Serializable, ParagraphJobListener { if (index < 0 || index >= paragraphs.size()) { if (throwWhenIndexIsOutOfBound) { - throw new IndexOutOfBoundsException("paragraph size is " + paragraphs.size() + - " , index is " + index); + throw new IndexOutOfBoundsException( + "paragraph size is " + paragraphs.size() + " , index is " + index); } else { return; } @@ -448,7 +448,7 @@ public class Note implements Serializable, ParagraphJobListener { return new HashMap<>(); } } - + private Map<String, String> populatePragraphInfo(Paragraph p) { Map<String, String> info = new HashMap<>(); info.put("id", p.getId()); @@ -496,27 +496,15 @@ public class Note implements Serializable, ParagraphJobListener { p.setListener(jobListenerFactory.getParagraphJobListener(this)); String requiredReplName = p.getRequiredReplName(); Interpreter intp = factory.getInterpreter(getId(), requiredReplName); - if (intp == null) { - // TODO(jongyoul): Make "%jdbc" configurable from JdbcInterpreter - if (conf.getUseJdbcAlias() && null != (intp = factory.getInterpreter(getId(), "jdbc"))) { - String pText = p.getText().replaceFirst(requiredReplName, "jdbc(" + requiredReplName + ")"); - logger.debug("New paragraph: {}", pText); - p.setEffectiveText(pText); - } else { - String intpExceptionMsg = format("%s", - p.getJobName() - + "'s Interpreter " - + requiredReplName + " not found" - ); - InterpreterException intpException = new InterpreterException(intpExceptionMsg); - InterpreterResult intpResult = new InterpreterResult( - InterpreterResult.Code.ERROR, intpException.getMessage() - ); - p.setReturn(intpResult, intpException); - p.setStatus(Job.Status.ERROR); - throw intpException; - } + String intpExceptionMsg = + p.getJobName() + "'s Interpreter " + requiredReplName + " not found"; + InterpreterException intpException = new InterpreterException(intpExceptionMsg); + InterpreterResult intpResult = + new InterpreterResult(InterpreterResult.Code.ERROR, intpException.getMessage()); + p.setReturn(intpResult, intpException); + p.setStatus(Job.Status.ERROR); + throw intpException; } if (p.getConfig().get("enabled") == null || (Boolean) p.getConfig().get("enabled")) { intp.getScheduler().submit(p); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fe3dbdb1/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 60f3161..f326eba 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 @@ -53,7 +53,6 @@ public class Paragraph extends Job implements Serializable, Cloneable { private transient InterpreterFactory factory; private transient Note note; private transient AuthenticationInfo authenticationInfo; - private transient String effectiveText; String title; String text; @@ -114,14 +113,6 @@ public class Paragraph extends Job implements Serializable, Cloneable { this.dateUpdated = new Date(); } - public void setEffectiveText(String effectiveText) { - this.effectiveText = effectiveText; - } - - public String getEffectiveText() { - return effectiveText; - } - public AuthenticationInfo getAuthenticationInfo() { return authenticationInfo; } @@ -153,7 +144,7 @@ public class Paragraph extends Job implements Serializable, Cloneable { } public String getRequiredReplName() { - return getRequiredReplName(null != effectiveText ? effectiveText : text); + return getRequiredReplName(text); } public static String getRequiredReplName(String text) { @@ -182,7 +173,7 @@ public class Paragraph extends Job implements Serializable, Cloneable { } public String getScriptBody() { - return getScriptBody(null != effectiveText ? effectiveText : text); + return getScriptBody(text); } public static String getScriptBody(String text) { @@ -359,7 +350,6 @@ public class Paragraph extends Job implements Serializable, Cloneable { } } finally { InterpreterContext.remove(); - effectiveText = null; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fe3dbdb1/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java index cff66ad..255e609 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java @@ -83,27 +83,6 @@ public class NoteTest { } @Test - public void runJdbcTest() { - when(interpreterFactory.getInterpreter(anyString(), eq("mysql"))).thenReturn(null); - when(interpreterFactory.getInterpreter(anyString(), eq("jdbc"))).thenReturn(interpreter); - when(interpreter.getScheduler()).thenReturn(scheduler); - - String pText = "%mysql show databases"; - - Note note = new Note(repo, interpreterFactory, jobListenerFactory, index, credentials, noteEventListener); - Paragraph p = note.addParagraph(); - p.setText(pText); - note.run(p.getId()); - - ArgumentCaptor<Paragraph> pCaptor = ArgumentCaptor.forClass(Paragraph.class); - verify(scheduler, only()).submit(pCaptor.capture()); - verify(interpreterFactory, times(2)).getInterpreter(anyString(), anyString()); - - assertEquals("Change paragraph text", "%jdbc(mysql) show databases", pCaptor.getValue().getEffectiveText()); - assertEquals("Change paragraph text", pText, pCaptor.getValue().getText()); - } - - @Test public void putDefaultReplNameIfInterpreterSettingAbsent() { when(interpreterFactory.getDefaultInterpreterSetting(anyString())) .thenReturn(null); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fe3dbdb1/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java index 1f8519c..668914a 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java @@ -74,32 +74,6 @@ public class ParagraphTest { } @Test - public void effectiveTextTest() { - InterpreterFactory interpreterFactory = mock(InterpreterFactory.class); - Interpreter interpreter = mock(Interpreter.class); - Note note = mock(Note.class); - - Paragraph p = new Paragraph("paragraph", note, null, interpreterFactory); - p.setText("%h2 show databases"); - p.setEffectiveText("%jdbc(h2) show databases"); - assertEquals("Get right replName", "jdbc", p.getRequiredReplName()); - assertEquals("Get right scriptBody", "(h2) show databases", p.getScriptBody()); - - when(interpreterFactory.getInterpreter(anyString(), eq("jdbc"))).thenReturn(interpreter); - when(interpreter.getFormType()).thenReturn(Interpreter.FormType.NATIVE); - when(note.getId()).thenReturn("noteId"); - - try { - p.jobRun(); - } catch (Throwable throwable) { - // Do nothing - } - - assertEquals("Erase effective Text", "h2", p.getRequiredReplName()); - assertEquals("Erase effective Text", "show databases", p.getScriptBody()); - } - - @Test public void should_extract_variable_from_angular_object_registry() throws Exception { //Given final String noteId = "noteId";