-
Notifications
You must be signed in to change notification settings - Fork 174
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
813c0ae
commit bd70365
Showing
1 changed file
with
16 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,16 @@ | ||
from __future__ import annotations | ||
|
||
from pyspark.sql.functions import col | ||
|
||
|
||
def test_where(spark_session): | ||
# Create DataFrame from range(10) | ||
df = spark_session.range(10) | ||
|
||
# Filter the DataFrame where 'id' is greater than 5 | ||
df_filtered = df.where(col("id") > 5) | ||
|
||
# Verify the filter was applied correctly by checking the expected data | ||
df_filtered_pandas = df_filtered.toPandas() | ||
expected_data = [6, 7, 8, 9] | ||
assert df_filtered_pandas["id"].tolist() == expected_data, "Filtered data does not match expected data" |