Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Create a DataFrame with single LongType column named id, containing elements in a range from start to end (exclusive) with step value step.
Syntax
spark.tvf.range(start, end=None, step=1, numPartitions=None)
Parameters
| Parameter | Type | Description |
|---|---|---|
start |
int | The start value. |
end |
int, optional | The end value (exclusive). |
step |
int, optional | The incremental step (default: 1). |
numPartitions |
int, optional | The number of partitions of the DataFrame. |
Examples
Example 1: Generate range with start, end, and step
spark.tvf.range(1, 7, 2).show()
+---+
| id|
+---+
| 1|
| 3|
| 5|
+---+
Example 2: Generate range with only end value
spark.tvf.range(3).show()
+---+
| id|
+---+
| 0|
| 1|
| 2|
+---+