-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-1348700 Fix index issues in handling of CaseExpr, IsNull, IsNotN…
…ull and Like expressions (#1704)
- Loading branch information
1 parent
721f942
commit 133ff6e
Showing
3 changed files
with
34 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved. | ||
# | ||
|
||
from snowflake.snowpark.functions import col, when | ||
from snowflake.snowpark.row import Row | ||
|
||
|
||
def test_casewhen_with_non_zero_row_index(session): | ||
df = session.create_dataframe([[1, 2], [3, 4]], schema=["a", "b"]) | ||
assert df.filter(col("a") > 1).select( | ||
when(col("a").is_null(), 5).when(col("a") == 1, 6).otherwise(7).as_("a") | ||
).collect() == [Row(A=7)] | ||
|
||
|
||
def test_like_with_non_zero_row_index(session): | ||
df = session.create_dataframe([["1", 2], ["3", 4]], schema=["a", "b"]) | ||
assert df.filter(col("b") > 2).select( | ||
col("a").like("1").alias("res") | ||
).collect() == [Row(RES=False)] |