Skip to content

Commit

Permalink
address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
gatorsmile committed Feb 6, 2018
1 parent 9e97db9 commit b837053
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions R/pkg/R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -1026,9 +1026,9 @@ setMethod("last_day",
})

#' @details
#' \code{length}: Computes the character length of a given string or number of bytes
#' of a binary string. The length of character strings include the trailing spaces.
#' The length of binary strings includes binary zeros.
#' \code{length}: Computes the character length of a string data or number of bytes
#' of a binary data. The length of string data includes the trailing spaces.
#' The length of binary data includes binary zeros.
#'
#' @rdname column_string_functions
#' @aliases length length,Column-method
Expand Down
4 changes: 2 additions & 2 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,8 +1705,8 @@ def unhex(col):
@ignore_unicode_prefix
@since(1.5)
def length(col):
"""Computes the character length of a given string or number of bytes of a binary string.
The length of character strings include the trailing spaces. The length of binary strings
"""Computes the character length of string data or number of bytes of binary data.
The length of character data includes the trailing spaces. The length of binary data
includes binary zeros.
>>> spark.createDataFrame([('ABC ',)], ['a']).select(length('a').alias('length')).collect()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1653,11 +1653,10 @@ case class Left(str: Expression, len: Expression, child: Expression) extends Run
* A function that returns the char length of the given string expression or
* number of bytes of the given binary expression.
*/
// scalastyle:off line.size.limit
@ExpressionDescription(
usage = "_FUNC_(expr) - Returns the character length of `expr` or number of bytes in binary data. " +
"The length of character strings include the trailing spaces. The length of binary strings " +
"includes binary zeros.",
usage = "_FUNC_(expr) - Returns the character length of string data or number of bytes of " +
"binary data. The length of string data includes the trailing spaces. The length of binary " +
"data includes binary zeros.",
examples = """
Examples:
> SELECT _FUNC_('Spark SQL ');
Expand All @@ -1667,7 +1666,6 @@ case class Left(str: Expression, len: Expression, child: Expression) extends Run
> SELECT CHARACTER_LENGTH('Spark SQL ');
10
""")
// scalastyle:on line.size.limit
case class Length(child: Expression) extends UnaryExpression with ImplicitCastInputTypes {
override def dataType: DataType = IntegerType
override def inputTypes: Seq[AbstractDataType] = Seq(TypeCollection(StringType, BinaryType))
Expand All @@ -1689,7 +1687,7 @@ case class Length(child: Expression) extends UnaryExpression with ImplicitCastIn
* A function that returns the bit length of the given string or binary expression.
*/
@ExpressionDescription(
usage = "_FUNC_(expr) - Returns the bit length of `expr` or number of bits in binary data.",
usage = "_FUNC_(expr) - Returns the bit length of string data or number of bits of binary data.",
examples = """
Examples:
> SELECT _FUNC_('Spark SQL');
Expand Down Expand Up @@ -1718,7 +1716,8 @@ case class BitLength(child: Expression) extends UnaryExpression with ImplicitCas
* A function that returns the byte length of the given string or binary expression.
*/
@ExpressionDescription(
usage = "_FUNC_(expr) - Returns the byte length of `expr` or number of bytes in binary data.",
usage = "_FUNC_(expr) - Returns the byte length of string data or number of bytes of binary " +
"data.",
examples = """
Examples:
> SELECT _FUNC_('Spark SQL');
Expand Down

0 comments on commit b837053

Please sign in to comment.