diff --git a/tests/integ/scala/test_function_suite.py b/tests/integ/scala/test_function_suite.py index 6c4404b4606..ce9244c7091 100644 --- a/tests/integ/scala/test_function_suite.py +++ b/tests/integ/scala/test_function_suite.py @@ -1833,6 +1833,19 @@ def test_to_timestamp_numeric_scale_column( ], ) def test_to_timestamp_variant_column(to_type, expected, session, local_testing_mode): + data = [ + 12345678900, # integer + "12345678900", # string containing integer + "2024-02-01 12:34:56.789000", # timestamp str + datetime(2017, 12, 24, 12, 55, 59, 123456), # timestamp + ] + + if to_type == to_timestamp_ntz and IS_IN_STORED_PROC: + # integer in variant type depends on local time zone of the server + # while in sproc reg test, the timezone is non-deterministic leading to non-deterministic result + # here we pop the case of integer in variant type + expected.pop(0) + data.pop(0) with parameter_override( session, "timezone", @@ -1842,12 +1855,6 @@ def test_to_timestamp_variant_column(to_type, expected, session, local_testing_m # as we are testing Variant + Integer case # this timezone has to be the same as the one in session LocalTimezone.set_local_timezone(pytz.timezone("Etc/GMT+8")) - data = [ - 12345678900, # integer - "12345678900", # string containing integer - "2024-02-01 12:34:56.789000", # timestamp str - datetime(2017, 12, 24, 12, 55, 59, 123456), # timestamp - ] df = session.create_dataframe( data, StructType( diff --git a/tests/integ/test_df_to_pandas.py b/tests/integ/test_df_to_pandas.py index d33e79a0ec9..3f31909a6bf 100644 --- a/tests/integ/test_df_to_pandas.py +++ b/tests/integ/test_df_to_pandas.py @@ -265,7 +265,9 @@ def test_to_pandas_batches(session, local_testing_mode): break -@pytest.mark.localtest +@pytest.mark.skipif( + IS_IN_STORED_PROC, reason="SNOW-1362480, backend optimization in different reg env" +) def test_df_to_pandas_df(session): df = session.create_dataframe( [ @@ -365,15 +367,23 @@ def test_df_to_pandas_df(session): "A": pd.Series(["[\n 1,\n 2,\n 3,\n 4\n]"], dtype=object), "B": pd.Series([b"123"], dtype=object), "C": pd.Series([True], dtype=bool), - "D": pd.Series([1], dtype=np.int64), + "D": pd.Series( + [1], dtype=np.int64 + ), # in reg env, there can be backend optimization resulting in np.int8 "E": pd.Series([datetime.date(year=2023, month=10, day=30)], dtype=object), "F": pd.Series([decimal.Decimal(1)], dtype=np.int64), "G": pd.Series([1.23], dtype=np.float64), "H": pd.Series([1.23], dtype=np.float64), - "I": pd.Series([100], dtype=np.int64), - "J": pd.Series([100], dtype=np.int64), + "I": pd.Series( + [100], dtype=np.int64 + ), # in reg env, there can be backend optimization resulting in np.int8 + "J": pd.Series( + [100], dtype=np.int64 + ), # in reg env, there can be backend optimization resulting in np.int8 "K": pd.Series([None], dtype=object), - "L": pd.Series([100], dtype=np.int64), + "L": pd.Series( + [100], dtype=np.int64 + ), # in reg env, there can be backend optimization resulting in np.int8 "M": pd.Series(["abc"], dtype=object), "N": pd.Series( [datetime.datetime(2023, 10, 30, 12, 12, 12)], dtype="datetime64[ns]" diff --git a/tests/integ/test_function.py b/tests/integ/test_function.py index dc1b76cc474..7d6e088c7a5 100644 --- a/tests/integ/test_function.py +++ b/tests/integ/test_function.py @@ -163,6 +163,8 @@ StringType, StructField, StructType, + TimestampTimeZone, + TimestampType, VariantType, ) from tests.utils import TestData, Utils @@ -388,13 +390,15 @@ def test_date_or_time_to_char(session, convert_func): datetime.datetime(2021, 12, 21, 9, 12, 56), datetime.datetime(1969, 1, 1, 1, 1, 1), ], - schema=["a"], + schema=StructType([StructField("a", TimestampType(TimestampTimeZone.NTZ))]), ) assert df.select(convert_func(col("a"), "mm-dd-yyyy mi:ss:hh24")).collect() == [ Row("12-21-2021 12:56:09"), Row("01-01-1969 01:01:01"), ] - assert df.select(convert_func(col("a"))).collect() == [ + # we explicitly set format here because in some test env the default output format is changed + # leading to different result + assert df.select(convert_func(col("a"), "yyyy-mm-dd hh24:mi:ss.FF3")).collect() == [ Row("2021-12-21 09:12:56.000"), Row("1969-01-01 01:01:01.000"), ]