Skip to content
Snippets Groups Projects
Commit 2c5a06ca authored by Reynold Xin's avatar Reynold Xin
Browse files

Update documentation for [SPARK-7980] [SQL] Support SQLContext.range(end)

parent 939e4f3d
No related branches found
No related tags found
No related merge requests found
......@@ -146,6 +146,8 @@ class SQLContext(object):
>>> sqlContext.range(1, 7, 2).collect()
[Row(id=1), Row(id=3), Row(id=5)]
If only one argument is specified, it will be used as the end value.
>>> sqlContext.range(3).collect()
[Row(id=0), Row(id=1), Row(id=2)]
"""
......
......@@ -705,33 +705,33 @@ class SQLContext(@transient val sparkContext: SparkContext)
/**
* :: Experimental ::
* Creates a [[DataFrame]] with a single [[LongType]] column named `id`, containing elements
* in an range from `start` to `end`(exclusive) with step value 1.
* in an range from 0 to `end` (exclusive) with step value 1.
*
* @since 1.4.0
* @since 1.4.1
* @group dataframe
*/
@Experimental
def range(start: Long, end: Long): DataFrame = {
createDataFrame(
sparkContext.range(start, end).map(Row(_)),
StructType(StructField("id", LongType, nullable = false) :: Nil))
}
def range(end: Long): DataFrame = range(0, end)
/**
* :: Experimental ::
* Creates a [[DataFrame]] with a single [[LongType]] column named `id`, containing elements
* in an range from 0 to `end`(exclusive) with step value 1.
* in an range from `start` to `end` (exclusive) with step value 1.
*
* @since 1.4.0
* @group dataframe
*/
@Experimental
def range(end: Long): DataFrame = range(0, end)
def range(start: Long, end: Long): DataFrame = {
createDataFrame(
sparkContext.range(start, end).map(Row(_)),
StructType(StructField("id", LongType, nullable = false) :: Nil))
}
/**
* :: Experimental ::
* Creates a [[DataFrame]] with a single [[LongType]] column named `id`, containing elements
* in an range from `start` to `end`(exclusive) with an step value, with partition number
* in an range from `start` to `end` (exclusive) with an step value, with partition number
* specified.
*
* @since 1.4.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment