HyukjinKwon commented on code in PR #59313:
URL: https://github.com/apache/spark/pull/59313#discussion_r4255251304


##########
python/pyspark/sql/session.py:
##########
@@ -2292,6 +2296,12 @@ def addArtifacts(
                     "condition": "True together",
                 },
             )
+        # Native data source packages are artifacts of the session in the JVM, 
whatever the
+        # flags, as with Spark Connect.
+        for p in path:
+            if p.endswith(".sparkpkg"):
+                self._jsparkSession.addArtifact(os.path.abspath(p))

Review Comment:
   Good catch, thanks. Fixed: a path with a URI scheme, such as 
`file:///tmp/some.sparkpkg`, is now passed to the JVM as is, where 
`addArtifact(String)` resolves it with `Utils.resolveURI`. Only a plain path 
goes through `os.path.abspath`, because the JVM would resolve a relative path 
against its own working directory. A Windows path such as `C:\x.sparkpkg`, 
which `urlparse` sees as having the scheme `c`, is treated as a path. 
`test_add_native_data_source_package` now also adds a `file://` URI and a path 
relative to a working directory that differs from the JVM's.
   



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to