You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/09/23 07:18:25 UTC

[GitHub] [flink] SteNicholas commented on a change in pull request #17322: [FLINK-24336][python] Fix the issue that jar url may be a empty string.

SteNicholas commented on a change in pull request #17322:
URL: https://github.com/apache/flink/pull/17322#discussion_r714524183



##########
File path: flink-python/pyflink/table/table_environment.py
##########
@@ -1695,12 +1695,14 @@ def _add_jars_to_j_env_config(self, config_key):
         jar_urls = self.get_config().get_configuration().get_string(config_key, None)
         if jar_urls is not None:
             # normalize and remove duplicates
-            jar_urls_set = set([jvm.java.net.URL(url).toString() for url in jar_urls.split(";")])
+            # do not use set, because set does not guarantee order.
+            jar_urls_list = [jvm.java.net.URL(url).toString() for url in jar_urls.split(";")]

Review comment:
       > I guess this is not necessary. Why we need to keep the order?
   
   +1, because the empty string is impossible in the middle of set. Therefore it's unnecessary to update this.

##########
File path: flink-python/pyflink/table/table_environment.py
##########
@@ -1695,12 +1695,14 @@ def _add_jars_to_j_env_config(self, config_key):
         jar_urls = self.get_config().get_configuration().get_string(config_key, None)
         if jar_urls is not None:
             # normalize and remove duplicates
-            jar_urls_set = set([jvm.java.net.URL(url).toString() for url in jar_urls.split(";")])
+            # do not use set, because set does not guarantee order.
+            jar_urls_list = [jvm.java.net.URL(url).toString() for url in jar_urls.split(";")]
             j_configuration = get_j_env_configuration(self._get_j_env())
             if j_configuration.containsKey(config_key):
                 for url in j_configuration.getString(config_key, "").split(";"):
-                    jar_urls_set.add(url)
-            j_configuration.setString(config_key, ";".join(jar_urls_set))
+                    if url != "" and url not in jar_urls_list:

Review comment:
       It's recommended to trim the uri and then check where the url is equal to emty string.




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org