Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fix merge_asof test disabled sql simplifier #2156

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions tests/integ/modin/test_merge_asof.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
#

import re

import modin.pandas as pd
import numpy as np
import pandas as native_pd
Expand Down Expand Up @@ -259,16 +261,18 @@ def test_merge_asof_negative_non_numeric_on(left_right_native_df_non_numeric_on)
)
# pandas raises a ValueError with incompatible merge dtype
with pytest.raises(
ValueError,
match="Incompatible merge dtype, dtype\\('O'\\) and dtype\\('O'\\), both sides must have numeric dtype",
MergeError,
match=re.escape(
"Incompatible merge dtype, dtype('O') and dtype('O'), both sides must have numeric dtype"
),
):
native_pd.merge_asof(left_native_df, right_native_df, on="a")
# Snowpark pandas raises a SnowparkSQLException
# MATCH_CONDITION clause is invalid: The left and right side expressions must be numeric or timestamp expressions.
with pytest.raises(
SnowparkSQLException,
):
pd.merge_asof(left_snow_df, right_snow_df, on="a")
pd.merge_asof(left_snow_df, right_snow_df, on="a").to_pandas()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfc-gh-nkrishna are those test skipped in the merge gate? how com it didn't fail in the merge gate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm not sure about that as well, it shouldn't be skipped....

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They failed when the SQL optimizer was disabled which only run in github daily.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfc-gh-azhan do you mean SqlSimpflication?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that kind of make sense, the sql simplification tiggers an describing call when extracting ColumnState for select, that could explain it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes



@sql_count_checker(query_count=0)
Expand Down Expand Up @@ -301,26 +305,34 @@ def test_merge_asof_negative_multiple_on(left_right_native_df):
right_on=["a", "another_col_right"],
)
# ValueError is raised when left_on and right_on are lists not of the same length
with pytest.raises(ValueError, match=r"len\(right_on\) must equal len\(left_on\)"):
with pytest.raises(
ValueError, match=re.escape("len(right_on) must equal len(left_on)")
):
native_pd.merge_asof(
left_native_df,
right_native_df,
left_on=["a"],
right_on=["a", "another_col_right"],
)
with pytest.raises(ValueError, match=r"len\(right_on\) must equal len\(left_on\)"):
with pytest.raises(
ValueError, match=re.escape("len(right_on) must equal len(left_on)")
):
pd.merge_asof(
left_snow_df,
right_snow_df,
left_on=["a"],
right_on=["a", "another_col_right"],
)
# ValueError is raised when left_on is a list of length > 1 and right_on is a scalar
with pytest.raises(ValueError, match=r"len\(right_on\) must equal len\(left_on\)"):
with pytest.raises(
ValueError, match=re.escape("len(right_on) must equal len(left_on)")
):
native_pd.merge_asof(
left_native_df, right_native_df, left_on=["a", "another_col"], right_on="a"
)
with pytest.raises(ValueError, match=r"len\(right_on\) must equal len\(left_on\)"):
with pytest.raises(
ValueError, match=re.escape("len(right_on) must equal len(left_on)")
):
pd.merge_asof(
left_snow_df, right_snow_df, left_on=["a", "another_col"], right_on="a"
)
Expand Down
Loading