Skip to content

Commit 102bacc

Browse files
address comments
1 parent a4a6439 commit 102bacc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/snowflake/snowpark/modin/plugin/compiler/snowflake_query_compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16840,7 +16840,7 @@ def output_col(
1684016840
# Follow pandas behavior
1684116841
return pandas_lit(np.nan)
1684216842
elif n < -1 and not pandas.isnull(pat) and len(str(pat)) > 1:
16843-
# Follow pandas behavior, which seems to leave the input column as is
16843+
# Follow pandas behavior, which based on our experiments, leaves the input column as is
1684416844
# whenever the above condition is satisfied.
1684516845
new_col = iff(
1684616846
column.is_null(), pandas_lit(None), array_construct(column)
@@ -16917,7 +16917,7 @@ def output_cols(
1691716917
final_splits = min(n + 1, max_splits)
1691816918

1691916919
if n < -1 and not pandas.isnull(pat) and len(str(pat)) > 1:
16920-
# Follow pandas behavior, which seems to leave the input column as is
16920+
# Follow pandas behavior, which based on our experiments, leaves the input column as is
1692116921
# whenever the above condition is satisfied.
1692216922
final_splits = 1
1692316923

tests/integ/modin/series/test_str_accessor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,9 @@ def test_str_replace_neg(pat, n, repl, error):
370370
snow_ser.str.replace(pat=pat, repl=repl, n=n)
371371

372372

373-
@pytest.mark.parametrize("pat", [None, "a", "ab", "non_occurrence_pat", "|", "%"])
373+
@pytest.mark.parametrize(
374+
"pat", [None, "a", "ab", "abc", "non_occurrence_pat", "|", "%"]
375+
)
374376
@pytest.mark.parametrize("n", [None, np.nan, 3, 2, 1, 0, -1, -2])
375377
@sql_count_checker(query_count=1)
376378
def test_str_split_expand_false(pat, n):
@@ -383,7 +385,7 @@ def test_str_split_expand_false(pat, n):
383385
)
384386

385387

386-
@pytest.mark.parametrize("pat", [None, "a", "ab", "no_occurrence_pat", "|", "%"])
388+
@pytest.mark.parametrize("pat", [None, "a", "ab", "abc", "no_occurrence_pat", "|", "%"])
387389
@pytest.mark.parametrize("n", [None, np.nan, 3, 2, 1, 0, -1, -2])
388390
@sql_count_checker(query_count=2)
389391
def test_str_split_expand_true(pat, n):

0 commit comments

Comments
 (0)