-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Labels
local testingLocal Testing issues/PRsLocal Testing issues/PRsstatus-pr_pending_mergeA PR is made and is under reviewA PR is made and is under reviewstatus-triage_doneInitial triage done, will be further handled by the driver teamInitial triage done, will be further handled by the driver team
Description
What is the current behavior?
The nullifzero() function is not implemented in the Local Testing Framework. When we attempt to use this function with local_testing=True, they encounter the following error:
from snowflake.snowpark import Session
from snowflake.snowpark.functions import col, nullifzero
session = Session.builder.config("local_testing", True).create()
df = session.create_dataframe([[0], [1], [100]], schema=["value"])
result = df.select(nullifzero(col("value")))
result.show()error:
NotImplementedError: [Local Testing] Function nullifzero is not implemented.
You can implement and make a patch by using the `snowflake.snowpark.mock.patch` decorator.What is the desired behavior?
The nullifzero() function should work in Local Testing mode with the following behavior:
- When the input value is
0(integer or float), returnNULL - When the input value is non-zero, return the original value
- Maintain the original data type while ensuring the result is nullable
This would match the behavior of Snowflake's NULLIFZERO SQL function.
If this is not an existing feature in snowflake-snowpark-python. How would this impact/improve non local testing mode?
This feature does not impact non-local testing mode. The nullifzero() function already works correctly when connected to Snowflake.
References, Other Background
#4036
I'm willing to implement this feature and submit a pull request. The implementation would include:
-
mock_nullifzerofunction insrc/snowflake/snowpark/mock/_functions.py -
test_nullifzerotest case intests/mock/test_functions.py
Metadata
Metadata
Assignees
Labels
local testingLocal Testing issues/PRsLocal Testing issues/PRsstatus-pr_pending_mergeA PR is made and is under reviewA PR is made and is under reviewstatus-triage_doneInitial triage done, will be further handled by the driver teamInitial triage done, will be further handled by the driver team