Skip to content

Commit 8e44d9b

Browse files
SNOW-2005919: update tests to fix disabled sql simplifier workflow (#3195)
Signed-off-by: Labanya Mukhopadhyay <[email protected]>
1 parent da58daa commit 8e44d9b

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

tests/integ/modin/groupby/test_groupby_transform.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,7 @@ def test_dataframe_groupby_transform_conflicting_labels_negative():
145145
pd.show(df)
146146

147147

148-
@sql_count_checker(
149-
query_count=7,
150-
# Pivot step performs force materialization of the dataframe. So joins in subquery
151-
# are not carried over but after removing the pivot step subquery is present
152-
# multiple times resulting to increase in join count.
153-
join_count=12,
154-
udtf_count=1,
155-
high_count_expected=True,
156-
high_count_reason="performing two groupby transform operations that use UDTFs and compare with pandas",
157-
)
158-
def test_dataframe_groupby_transform_conflicting_labels():
148+
def test_dataframe_groupby_transform_conflicting_labels(session):
159149
"""
160150
Based on SNOW-1361200 - The bug occurred because of conflicting UDTF columns appended during groupby transform
161151
operations in `create_udtf_for_groupby_apply`.
@@ -167,11 +157,19 @@ def transform_helper(df):
167157
df["A"] = df.groupby("X")["X_DATA"].transform("count")
168158
df["B"] = df.groupby("X")["X_DATA"].transform("count")
169159

170-
eval_snowpark_pandas_result(
171-
*create_test_dfs({"X": [1, 2, 3, 1, 2, 2], "Y": [4, 5, 6, 7, 8, 9]}),
172-
transform_helper,
173-
inplace=True,
174-
)
160+
with SqlCounter(
161+
query_count=7,
162+
join_count=12 if session.sql_simplifier_enabled else 6,
163+
udtf_count=1,
164+
high_count_expected=True,
165+
high_count_reason="performing two groupby transform operations that use UDTFs and compare "
166+
"with pandas",
167+
):
168+
eval_snowpark_pandas_result(
169+
*create_test_dfs({"X": [1, 2, 3, 1, 2, 2], "Y": [4, 5, 6, 7, 8, 9]}),
170+
transform_helper,
171+
inplace=True,
172+
)
175173

176174

177175
@sql_count_checker(

tests/integ/modin/test_df_to_snowpark_pandas.py

+5
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ def test_to_snowpark_pandas_with_operations(
141141
def test_to_snowpark_pandas_duplicated_columns_raises(
142142
session, tmp_table_basic, relaxed_ordering
143143
) -> None:
144+
sql_simplifier_enabled_original = session.sql_simplifier_enabled
145+
# Error is raised only when SQL simplifier is enabled.
146+
session.sql_simplifier_enabled = True
147+
144148
snowpark_df = session.table(tmp_table_basic)
145149
snowpark_df = snowpark_df.select(
146150
Column("ID"),
@@ -156,6 +160,7 @@ def test_to_snowpark_pandas_duplicated_columns_raises(
156160

157161
with pytest.raises(SnowparkSQLException, match=pattern):
158162
snowpark_df.to_snowpark_pandas(relaxed_ordering=relaxed_ordering).head()
163+
session.sql_simplifier_enabled = sql_simplifier_enabled_original
159164

160165

161166
@pytest.mark.parametrize("relaxed_ordering", [True, False])

0 commit comments

Comments
 (0)