This is an automated email from the ASF dual-hosted git repository.
zjffdu pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/branch-0.9 by this push:
new 4d17d56 [ZEPPELIN-5052]. Unable to set multiple local properties in
ZSession
4d17d56 is described below
commit 4d17d560e960a1793d954f02535ac186be160667
Author: Jeff Zhang <[email protected]>
AuthorDate: Fri Sep 18 10:28:59 2020 +0800
[ZEPPELIN-5052]. Unable to set multiple local properties in ZSession
### What is this PR for?
The root cause is that the local properties format is not correct, we
should separate them via dot. This PR fix it and also add unit test for this
scenario.
### What type of PR is it?
[Bug Fix ]
### Todos
* [ ] - Task
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-5052
### 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 <[email protected]>
Closes #3916 from zjffdu/ZEPPELIN-5052 and squashes the following commits:
08229d93f [Jeff Zhang] [ZEPPELIN-5052]. Unable to set multiple local
properties in ZSession
(cherry picked from commit d6ea95061de83ac2f4fc126153edd8224615a666)
Signed-off-by: Jeff Zhang <[email protected]>
---
.../src/main/java/org/apache/zeppelin/client/ZSession.java | 9 ++++++---
.../org/apache/zeppelin/integration/ZSessionIntegrationTest.java | 1 +
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git
a/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZSession.java
b/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZSession.java
index cc07e5d..01600f4 100644
--- a/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZSession.java
+++ b/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZSession.java
@@ -27,7 +27,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
* Each ZSession represent one interpreter process, you can start/stop it, and
execute/submit/cancel code.
@@ -263,9 +265,10 @@ public class ZSession {
}
if (localProperties != null && !localProperties.isEmpty()) {
builder.append("(");
- for (Map.Entry<String, String> entry : localProperties.entrySet()) {
- builder.append(entry.getKey() + "=\"" + entry.getValue() + "\"");
- }
+ List<String> propertyString = localProperties.entrySet().stream()
+ .map(entry -> (entry.getKey() + "=\"" + entry.getValue() + "\""))
+ .collect(Collectors.toList());
+ builder.append(StringUtils.join(propertyString, ","));
builder.append(")");
}
builder.append("\n" + code);
diff --git
a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZSessionIntegrationTest.java
b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZSessionIntegrationTest.java
index ac9c5d7..12042c8 100644
---
a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZSessionIntegrationTest.java
+++
b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/ZSessionIntegrationTest.java
@@ -324,6 +324,7 @@ public class ZSessionIntegrationTest extends
AbstractTestRestApi {
assertEquals(result.toString(), Status.FINISHED, result.getStatus());
Map<String, String> localProperties = new HashMap<>();
localProperties.put("type", "update");
+ localProperties.put("parallelism", "2");
result = session.execute("ssql", localProperties, "select url, count(1)
as pv from log group by url");
assertEquals(result.toString(), Status.FINISHED, result.getStatus());