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): ...@@ -146,6 +146,8 @@ class SQLContext(object):
>>> sqlContext.range(1, 7, 2).collect() >>> sqlContext.range(1, 7, 2).collect()
[Row(id=1), Row(id=3), Row(id=5)] [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() >>> sqlContext.range(3).collect()
[Row(id=0), Row(id=1), Row(id=2)] [Row(id=0), Row(id=1), Row(id=2)]
""" """
......
...@@ -705,33 +705,33 @@ class SQLContext(@transient val sparkContext: SparkContext) ...@@ -705,33 +705,33 @@ class SQLContext(@transient val sparkContext: SparkContext)
/** /**
* :: Experimental :: * :: Experimental ::
* Creates a [[DataFrame]] with a single [[LongType]] column named `id`, containing elements * 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 * @group dataframe
*/ */
@Experimental @Experimental
def range(start: Long, end: Long): DataFrame = { def range(end: Long): DataFrame = range(0, end)
createDataFrame(
sparkContext.range(start, end).map(Row(_)),
StructType(StructField("id", LongType, nullable = false) :: Nil))
}
/** /**
* :: Experimental :: * :: Experimental ::
* Creates a [[DataFrame]] with a single [[LongType]] column named `id`, containing elements * 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 * @since 1.4.0
* @group dataframe * @group dataframe
*/ */
@Experimental @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 :: * :: Experimental ::
* Creates a [[DataFrame]] with a single [[LongType]] column named `id`, containing elements * 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. * specified.
* *
* @since 1.4.0 * @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