-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Labels
status-triage_doneInitial triage done, will be further handled by the driver teamInitial triage done, will be further handled by the driver team
Description
Please answer these questions before submitting your issue. Thanks!
-
What version of Python are you using?
Python 3.12.11
-
What operating system and processor architecture are you using?
macOS-26.2-arm64-arm-64bit
-
What are the component versions in the environment (
pip freeze)?snowflake-connector-python==4.3.0 snowflake-ml-python==1.29.0 snowflake-snowpark-python==1.47.0 -
What did you do?
from snowflake.snowpark import Session from snowflake.snowpark.functions import col, square from snowflake.snowpark.mock import patch @patch(square) def mock_square(x): raise AssertionError("never reached") session = Session.builder.config("local_testing", True).getOrCreate() df = session.create_dataframe([[1]], schema=["x"]) df.select(square(col("x"))).collect() # NameError: name 'snowflake' is not defined
-
What did you expect to see?
The patch function (
mock_square) should be executed. Instead, the following error is thrown:NameError: name 'snowflake' is not defined -
Can you set logging to DEBUG and collect the logs?
N/A
Suspected Issue
- The
ColumnOrName = Union["snowflake.snowpark.column.Column", str]typedef in _internal/type_utils.py
uses a forward ref. - When
handle_function_expressioncalls typing.get_type_hints() on the
original function being patched, it evaluates the forward ref in_functions/scalar_functions.py's globals
where'snowflake'is not a bare name.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status-triage_doneInitial triage done, will be further handled by the driver teamInitial triage done, will be further handled by the driver team