diff --git a/docs/install/upgrade.md b/docs/install/upgrade.md index 16e96e8d2be..60a8f885a5b 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. 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 d146a25fad9..d4f31863ed5 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 String getWebsocketMaxTextMessageSize() { return getString(ConfVars.ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE); } - public boolean getUseJdbcAlias() { - return getBoolean(ConfVars.ZEPPELIN_USE_JDBC_ALIAS); - } - public Map dumpConfigurations(ZeppelinConfiguration conf, ConfigurationKeyPredicate predicate) { Map configurations = new HashMap<>(); @@ -557,9 +553,7 @@ public static enum ConfVars { 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") 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 0b2b4c652dd..5f0f7c1ab13 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 void moveParagraph(String paragraphId, int index, boolean throwWhenIndexI 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 Map generateSingleParagraphInfo(String paragraphId) { return new HashMap<>(); } } - + private Map populatePragraphInfo(Paragraph p) { Map info = new HashMap<>(); info.put("id", p.getId()); @@ -496,27 +496,15 @@ public void run(String paragraphId) { 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); 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 60f31616c55..f326ebaf454 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 void setText(String newText) { 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 boolean isEnabled() { } public String getRequiredReplName() { - return getRequiredReplName(null != effectiveText ? effectiveText : text); + return getRequiredReplName(text); } public static String getRequiredReplName(String text) { @@ -182,7 +173,7 @@ public static String getRequiredReplName(String text) { } public String getScriptBody() { - return getScriptBody(null != effectiveText ? effectiveText : text); + return getScriptBody(text); } public static String getScriptBody(String text) { @@ -359,7 +350,6 @@ protected Object jobRun() throws Throwable { } } finally { InterpreterContext.remove(); - effectiveText = null; } } 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 cff66adc78d..255e609ca38 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 @@ -82,27 +82,6 @@ public void runNormalTest() { assertEquals("Paragraph text", pText, pCaptor.getValue().getText()); } - @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 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())) 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 1f8519cb399..668914ae38a 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 @@ -73,32 +73,6 @@ public void replNameEndsWithWhitespace() { assertEquals("md", Paragraph.getRequiredReplName(text)); } - @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