-
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
Showing
1 changed file
with
19 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,19 @@ | ||
from __future__ import annotations | ||
|
||
|
||
def test_take(spark_session): | ||
# Create DataFrame with 10 rows | ||
df = spark_session.range(10) | ||
|
||
# Take first 5 rows and collect | ||
result = df.take(5) | ||
|
||
# Verify the expected values | ||
expected = df.limit(5).collect() | ||
|
||
assert result == expected | ||
|
||
# Test take with more rows than exist | ||
result_large = df.take(20) | ||
expected_large = df.collect() | ||
assert result_large == expected_large # Should return all existing rows |