diff --git a/CHANGELOG.md b/CHANGELOG.md index 877ea5a1835..4ca0988a0a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.11.1 (2023-11-07) + +### Bug Fixes + +- Fixed a bug that numpy should not be imported at the top level of mock module. + ## 1.11.0 (2023-11-05) ### New Features diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 60e5eddc697..cea4a8ab126 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,5 +1,5 @@ {% set name = "snowflake-snowpark-python" %} -{% set version = "1.11.0" %} +{% set version = "1.11.1" %} package: name: {{ name|lower }} diff --git a/src/snowflake/snowpark/mock/_util.py b/src/snowflake/snowpark/mock/_util.py index d40525f2ac2..c64ec334e14 100644 --- a/src/snowflake/snowpark/mock/_util.py +++ b/src/snowflake/snowpark/mock/_util.py @@ -6,8 +6,6 @@ from functools import cmp_to_key, partial from typing import Any, Tuple -import numpy - from snowflake.connector.options import pandas as pd from snowflake.snowpark.mock._snowflake_data_type import ColumnEmulator from snowflake.snowpark.types import ( @@ -190,6 +188,8 @@ def process_string_time_with_fractional_seconds(time: str, fractional_seconds) - def fix_drift_between_column_sf_type_and_dtype(col: ColumnEmulator): + import numpy + if ( isinstance(col.sf_type.datatype, _NumericType) and col.apply(lambda x: x is None).any() diff --git a/src/snowflake/snowpark/version.py b/src/snowflake/snowpark/version.py index c86e4642703..469ffb2d014 100644 --- a/src/snowflake/snowpark/version.py +++ b/src/snowflake/snowpark/version.py @@ -4,4 +4,4 @@ # # Update this for the versions -VERSION = (1, 11, 0) +VERSION = (1, 11, 1) diff --git a/tests/integ/test_udf.py b/tests/integ/test_udf.py index 3925741c3d2..fc9fd14afd6 100644 --- a/tests/integ/test_udf.py +++ b/tests/integ/test_udf.py @@ -38,8 +38,10 @@ ) is_pandas_available = True + numpy_funcs = [numpy.min, numpy.sqrt, numpy.tan, numpy.sum, numpy.median] except ImportError: is_pandas_available = False + numpy_funcs = [] from typing import Dict, List, Optional, Union @@ -2157,9 +2159,7 @@ def echo(num: int) -> int: (not is_pandas_available) or IS_IN_STORED_PROC, reason="numpy and pandas are required", ) -@pytest.mark.parametrize( - "func", [numpy.min, numpy.sqrt, numpy.tan, numpy.sum, numpy.median] -) +@pytest.mark.parametrize("func", numpy_funcs) def test_numpy_udf(session, func): numpy_udf = udf( func, return_type=DoubleType(), input_types=[DoubleType()], packages=["numpy"] diff --git a/tox.ini b/tox.ini index 00dae2ed4d2..6ecb5f5460b 100644 --- a/tox.ini +++ b/tox.ini @@ -78,7 +78,6 @@ deps = pip >= 19.3.1 pytest-xdist pytest-timeout - pyarrow .[development] commands = {env:SNOWFLAKE_PYTEST_CMD} -vvv -m "integ or unit" {posargs:} tests