We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
df.take()
1 parent 5b36bd0 commit 31a7abcCopy full SHA for 31a7abc
tests/connect/test_take.py
@@ -0,0 +1,19 @@
1
+from __future__ import annotations
2
+
3
4
+def test_take(spark_session):
5
+ # Create DataFrame with 10 rows
6
+ df = spark_session.range(10)
7
8
+ # Take first 5 rows and collect
9
+ result = df.take(5)
10
11
+ # Verify the expected values
12
+ expected = df.limit(5).collect()
13
14
+ assert result == expected
15
16
+ # Test take with more rows than exist
17
+ result_large = df.take(20)
18
+ expected_large = df.collect()
19
+ assert result_large == expected_large # Should return all existing rows
0 commit comments