SNOW-4174500: Fix nested udxf inheriting inaccessable stage path - #4412
Open
sfc-gh-mayliu wants to merge 2 commits into
Open
sfc-gh-mayliu wants to merge 2 commits into
sfc-gh-mayliu wants to merge 2 commits into
Conversation
sfc-gh-mayliu
requested review from
sfc-gh-bkogan,
sfc-gh-yixie and
sfc-gh-yuwang
October 3, 2026 01:45
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4412 +/- ##
=======================================
Coverage 95.46% 95.47%
=======================================
Files 176 176
Lines 45271 45295 +24
Branches 7759 7766 +7
=======================================
+ Hits 43220 43245 +25
+ Misses 1270 1269 -1
Partials 781 781 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-4174500
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.
Bug
When a stored procedure declares
IMPORTS, Snowflake resolves those to absolute app-package stage paths and seeds them into session._import_paths. Any nested UDxF registered inside that procedure with no explicitimports=argument inherits those paths verbatim into its DDL, i.e:The executing role can't access that
pandas_helper.pypath on stage, so Snowflake rejects the DDL. This affectsapply_in_pandas,session.udf.register,session.udtf.register, and any other UDxF registration that omitsimports=.Fix
Inside a stored procedure, the platform already extracts every staged import to a local temp directory (
sys._xoptions["snowflake_import_directory"]).https://docs.snowflake.com/en/developer-guide/udf/python/udf-python-examples#reading-a-statically-specified-file-using-imports
The fix looks for each stage path's file there and re-uploads it to the session's own temp stage, so that the executing role always owns the redirected path and replaces the inaccessible original path. No behavioral change outside a stored procedure since this fix targets nested UDxF calls. Can be disabled via
session.conf.set("restage_stored_procedure_imports", False)