[ZEPPELIN-2216] general solution to precode. refactoring jdbc precode#2221
[ZEPPELIN-2216] general solution to precode. refactoring jdbc precode#2221tinkoff-dwh wants to merge 5 commits into
Conversation
|
ready to review |
|
@Leemoonsoo |
|
Let me take a look in this weekend! |
| LazyOpenInterpreter lazy = (LazyOpenInterpreter) interpreter; | ||
| if (!lazy.isOpen()) { | ||
| lazy.open(); | ||
| result = lazy.executePrecode(context); |
There was a problem hiding this comment.
Shouldn't RemoteInterpreterServer.open() also call executePrecode()?
There was a problem hiding this comment.
it must be called once per instance of the interprete
There was a problem hiding this comment.
@Leemoonsoo
works same as the previous jdbc precode.
case:
user: some_user
JDBC interpreter (per user)
- there is precode
CREATE table IF NOT EXISTS tbl_#{user} - user executes
insert into tbm_some_user ...- execute
precode - execute paragraph text
- execute
- user executes
select *from tbm_some_user- execute paragraph text
Spark
- there is precode
var someConst = 12 ... - User executes
var result = 1 + someConst- execute
precode - execute paragraph text
- execute
- User executes var
result2 = 2 + someConts
print(result2)
- execute only paragraph text
There was a problem hiding this comment.
Thanks for explain.
Currently, unittest https://github.com/apache/zeppelin/pull/2221/files#diff-9c5e6fbaa5b23bc0192b4fedc12b2680R445 executes jdbcInterpreter.executePrecode(interpreterContext); manually after open().
Shell we have other unittest that does not call executePrecode() manually? so lazy.executePrecode in InterpreterServer can be verified.
zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java is one place the unittest actually creates RemoteInterpreter process and test against it. This place might be the place you can locate test for this feature.
There was a problem hiding this comment.
@Leemoonsoo
fix it, if I understand correctly your comment
ci green https://travis-ci.org/tinkoff-dwh/zeppelin/builds/225094590
# Conflicts: # jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
|
LGTM and merge to master if no further discussions. |
### What is this PR for? General solution to execute precode. Refactoring jdbc precode using general solution. Task contains to subtasks: executeAfterOpen, executeBeforeClose. executeBeforeClose not done because we need the context so there is a solution only for executeAfterOpen. ### What type of PR is it? Feature | Refactoring ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-2216 ### How should this be tested? 1. Add parameter zeppelin.PySparkInterpreter.precode `someVar='text'` 2. Execute ``` %pyspark print(someVar) ``` ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? no Author: Tinkoff DWH <tinkoff.dwh@gmail.com> Closes apache#2221 from tinkoff-dwh/ZEPPELIN-2216 and squashes the following commits: 1e3f3f7 [Tinkoff DWH] [ZEPPELIN-2216] fix path e4cf72f [Tinkoff DWH] [ZEPPELIN-2216] added tests 5a482a0 [Tinkoff DWH] [ZEPPELIN-2216] fix tests 3977722 [Tinkoff DWH] Merge remote-tracking branch 'origin/master' into ZEPPELIN-2216 c0436a2 [Tinkoff DWH] [ZEPPELIN-2216] general solution to precode. refactoring jdbc precode
### What is this PR for? General solution to execute precode. Refactoring jdbc precode using general solution. Task contains to subtasks: executeAfterOpen, executeBeforeClose. executeBeforeClose not done because we need the context so there is a solution only for executeAfterOpen. ### What type of PR is it? Feature | Refactoring ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-2216 ### How should this be tested? 1. Add parameter zeppelin.PySparkInterpreter.precode `someVar='text'` 2. Execute ``` %pyspark print(someVar) ``` ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? no Author: Tinkoff DWH <tinkoff.dwh@gmail.com> Closes apache#2221 from tinkoff-dwh/ZEPPELIN-2216 and squashes the following commits: 1e3f3f7 [Tinkoff DWH] [ZEPPELIN-2216] fix path e4cf72f [Tinkoff DWH] [ZEPPELIN-2216] added tests 5a482a0 [Tinkoff DWH] [ZEPPELIN-2216] fix tests 3977722 [Tinkoff DWH] Merge remote-tracking branch 'origin/master' into ZEPPELIN-2216 c0436a2 [Tinkoff DWH] [ZEPPELIN-2216] general solution to precode. refactoring jdbc precode
What is this PR for?
General solution to execute precode. Refactoring jdbc precode using general solution. Task contains to subtasks: executeAfterOpen, executeBeforeClose. executeBeforeClose not done because we need the context so there is a solution only for executeAfterOpen.
What type of PR is it?
Feature | Refactoring
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-2216
How should this be tested?
someVar='text'Questions: