This is an automated email from the ASF dual-hosted git repository.
dianfu pushed a commit to branch release-1.11
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.11 by this push:
new 61f4148 [FLINK-20183][python] Fix the default PYTHONPATH is
overwritten in client side
61f4148 is described below
commit 61f4148524931e47761c52c39e571e5f7bad7885
Author: huangxingbo <[email protected]>
AuthorDate: Wed Nov 18 11:09:35 2020 +0800
[FLINK-20183][python] Fix the default PYTHONPATH is overwritten in client
side
This closes #14108.
---
.../main/java/org/apache/flink/client/python/PythonEnvUtils.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/flink-python/src/main/java/org/apache/flink/client/python/PythonEnvUtils.java
b/flink-python/src/main/java/org/apache/flink/client/python/PythonEnvUtils.java
index 76370dc..eaf881f 100644
---
a/flink-python/src/main/java/org/apache/flink/client/python/PythonEnvUtils.java
+++
b/flink-python/src/main/java/org/apache/flink/client/python/PythonEnvUtils.java
@@ -26,6 +26,8 @@ import org.apache.flink.util.NetUtils;
import org.apache.flink.util.OperatingSystem;
import org.apache.flink.util.Preconditions;
+import org.apache.flink.shaded.guava18.com.google.common.base.Strings;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import py4j.CallbackClient;
@@ -245,7 +247,12 @@ final class PythonEnvUtils {
ProcessBuilder pythonProcessBuilder = new ProcessBuilder();
Map<String, String> env = pythonProcessBuilder.environment();
if (pythonEnv.pythonPath != null) {
- env.put("PYTHONPATH", pythonEnv.pythonPath);
+ String defaultPythonPath = env.get("PYTHONPATH");
+ if (Strings.isNullOrEmpty(defaultPythonPath)) {
+ env.put("PYTHONPATH", pythonEnv.pythonPath);
+ } else {
+ env.put("PYTHONPATH",
String.join(File.pathSeparator, pythonEnv.pythonPath, defaultPythonPath));
+ }
}
pythonEnv.systemEnv.forEach(env::put);
commands.add(0, pythonEnv.pythonExec);