Repository: spark
Updated Branches:
  refs/heads/master bbfd6b5d2 -> 4f7ec3a31


[SPARK][DOCS] Added note on meaning of position to substring function

## What changes were proposed in this pull request?

Enhanced some existing documentation

Please review http://spark.apache.org/contributing.html before opening a pull 
request.

Author: Mac <maclock...@gmail.com>

Closes #18710 from maclockard/maclockard-patch-1.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/4f7ec3a3
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/4f7ec3a3
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/4f7ec3a3

Branch: refs/heads/master
Commit: 4f7ec3a316fd2c6e0828d8777d29abb472fd7a14
Parents: bbfd6b5
Author: Mac <maclock...@gmail.com>
Authored: Mon Aug 7 17:16:03 2017 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Mon Aug 7 17:16:03 2017 +0100

----------------------------------------------------------------------
 python/pyspark/sql/functions.py                              | 4 +++-
 sql/core/src/main/scala/org/apache/spark/sql/functions.scala | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/4f7ec3a3/python/pyspark/sql/functions.py
----------------------------------------------------------------------
diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py
index 2c8c8e2..0e76182 100644
--- a/python/pyspark/sql/functions.py
+++ b/python/pyspark/sql/functions.py
@@ -1424,7 +1424,9 @@ def substring(str, pos, len):
     """
     Substring starts at `pos` and is of length `len` when str is String type or
     returns the slice of byte array that starts at `pos` in byte and is of 
length `len`
-    when str is Binary type
+    when str is Binary type.
+
+    .. note:: The position is not zero based, but 1 based index.
 
     >>> df = spark.createDataFrame([('abcd',)], ['s',])
     >>> df.select(substring(df.s, 1, 2).alias('s')).collect()

http://git-wip-us.apache.org/repos/asf/spark/blob/4f7ec3a3/sql/core/src/main/scala/org/apache/spark/sql/functions.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/functions.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/functions.scala
index ccff00e..496619a 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/functions.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/functions.scala
@@ -2408,6 +2408,8 @@ object functions {
    * returns the slice of byte array that starts at `pos` in byte and is of 
length `len`
    * when str is Binary type
    *
+   * @note The position is not zero based, but 1 based index.
+   *
    * @group string_funcs
    * @since 1.5.0
    */


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to