Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -533,20 +533,30 @@ object StringTrim {
@ExpressionDescription(
usage = """
_FUNC_(str) - Removes the leading and trailing space characters from `str`.
_FUNC_(BOTH trimStr FROM str) - Remove the leading and trailing trimString from `str`
_FUNC_(BOTH trimStr FROM str) - Remove the leading and trailing `trimStr` characters from `str`
_FUNC_(LEADING trimStr FROM str) - Remove the leading `trimStr` characters from `str`
_FUNC_(TRAILING trimStr FROM str) - Remove the trailing `trimStr` characters from `str`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd fold those lines into one if possible. If that looks quite messed, we could add each extra newline between _FUNC_(...)s. Currently, the doc is rendered as below:

2017-09-21 3 33 09

Copy link
Contributor Author

@kevinyu98 kevinyu98 Sep 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for finding this. I put the extra line there, then run this below

cd sql
create-docs.sh

it generate doc like this.

trim

trim(str) - Removes the leading and trailing space characters from str

trim(BOTH trimStr FROM str) - Remove the leading and trailing trimStr characters from str

trim(LEADING trimStr FROM str) - Remove the leading trimStr characters from str

trim(TRAILING trimStr FROM str) - Remove the trailing trimStr characters from str


and this is how describe function show:

spark-sql> describe function extended trim;
Function: trim
Class: org.apache.spark.sql.catalyst.expressions.StringTrim
Usage: 
    trim(str) - Removes the leading and trailing space characters from `str`

    trim(BOTH trimStr FROM str) - Remove the leading and trailing `trimStr` characters from `str`

    trim(LEADING trimStr FROM str) - Remove the leading `trimStr` characters from `str`

    trim(TRAILING trimStr FROM str) - Remove the trailing `trimStr` characters from `str`
  
Extended Usage:
    Arguments:
      * str - a string expression
      * trimStr - the trim string characters to trim, the default value is a single space
      * BOTH, FROM - these are keywords to specify trimming string characters from both ends of the string
      * LEADING, FROM - these are keywords to specify trimming string characters from the left end of the string
      * TRAILING, FROM - these are keywords to specify trimming string characters from the right end of the string
  
    Examples:
      > SELECT trim('    SparkSQL   ');
       SparkSQL
      > SELECT trim('SL', 'SSparkSQLS');
       parkSQ
      > SELECT trim(BOTH 'SL' FROM 'SSparkSQLS');
       parkSQ
      > SELECT trim(LEADING 'SL' FROM 'SSparkSQLS');
       parkSQLS
      > SELECT trim(TRAILING 'SL' FROM 'SSparkSQLS');
       SSparkSQ
  
Time taken: 1.924 seconds, Fetched 4 row(s)
17/09/22 01:06:39 INFO SparkSQLCLIDriver: Time taken: 1.924 seconds, Fetched 4 row(s)

""",
arguments = """
Arguments:
* str - a string expression
* trimString - the trim string
* BOTH, FROM - these are keyword to specify for trim string from both ends of the string
* trimStr - the trim string characters to trim, the default value is a single space
* BOTH, FROM - these are keywords to specify trimming string characters from both ends of the string
* LEADING, FROM - these are keywords to specify trimming string characters from the left end of the string
* TRAILING, FROM - these are keywords to specify trimming string characters from the right end of the string
""",
examples = """
Examples:
> SELECT _FUNC_(' SparkSQL ');
SparkSQL
> SELECT _FUNC_('SL', 'SSparkSQLS');
parkSQ
> SELECT _FUNC_(BOTH 'SL' FROM 'SSparkSQLS');
parkSQ
> SELECT _FUNC_(LEADING 'SL' FROM 'SSparkSQLS');
parkSQLS
> SELECT _FUNC_(TRAILING 'SL' FROM 'SSparkSQLS');
SSparkSQ
""")
case class StringTrim(
srcStr: Expression,
Expand Down Expand Up @@ -634,8 +644,7 @@ object StringTrimLeft {
arguments = """
Arguments:
* str - a string expression
* trimString - the trim string
* BOTH, FROM - these are keyword to specify for trim string from both ends of the string
* trimStr - the trim string characters to trim, the default value is a single space
""",
examples = """
Examples:
Expand Down Expand Up @@ -731,8 +740,7 @@ object StringTrimRight {
arguments = """
Arguments:
* str - a string expression
* trimString - the trim string
* BOTH, FROM - these are keyword to specify for trim string from both ends of the string
* trimStr - the trim string characters to trim, the default value is a single space
""",
examples = """
Examples:
Expand Down