-
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.
- Loading branch information
1 parent
f079a99
commit dc548c0
Showing
1 changed file
with
20 additions
and
0 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
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_regexp_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)] |