fsk119 commented on code in PR #21725:
URL: https://github.com/apache/flink/pull/21725#discussion_r1080917570
##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/context/DefaultContext.java:
##########
@@ -55,15 +58,31 @@ public DefaultContext(Configuration flinkConfig,
List<CustomCommandLine> command
flinkConfig,
PluginUtils.createPluginManagerFromRootFolder(flinkConfig));
Options commandLineOptions = collectCommandLineOptions(commandLines);
+
+ final List<URL> dependencies = new ArrayList<>();
+ // add python dependencies by default
+ try {
+ URL location =
+ Class.forName(
+
"org.apache.flink.python.PythonFunctionRunner",
+ false,
+
Thread.currentThread().getContextClassLoader())
+ .getProtectionDomain()
+ .getCodeSource()
+ .getLocation();
+ if (Paths.get(location.toURI()).toFile().isFile()) {
+ dependencies.add(location);
+ }
+ } catch (URISyntaxException | ClassNotFoundException e) {
+ throw new SqlExecutionException("Failed to find flink-python
jar.", e);
Review Comment:
I think we can modify the constructor of the DefaultContext to pass the
dependencies. During the loading, we always try to find the python dependencies
and add it into the dependencies.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]