Skip to content
Snippets Groups Projects
Commit 34dbc8af authored by Kazuaki Ishizaki's avatar Kazuaki Ishizaki Committed by Yin Huai
Browse files

[SPARK-12580][SQL] Remove string concatenations from usage and extended in @ExpressionDescription

Use multi-line string literals for ExpressionDescription with ``// scalastyle:off line.size.limit`` and ``// scalastyle:on line.size.limit``

The policy is here, as describe at https://github.com/apache/spark/pull/10488

Let's use multi-line string literals. If we have to have a line with more than 100 characters, let's use ``// scalastyle:off line.size.limit`` and ``// scalastyle:on line.size.limit`` to just bypass the line number requirement.

Author: Kazuaki Ishizaki <ishizaki@jp.ibm.com>

Closes #10524 from kiszk/SPARK-12580.
parent 83465183
No related branches found
No related tags found
No related merge requests found
...@@ -58,13 +58,13 @@ case class Md5(child: Expression) extends UnaryExpression with ImplicitCastInput ...@@ -58,13 +58,13 @@ case class Md5(child: Expression) extends UnaryExpression with ImplicitCastInput
* asking for an unsupported SHA function, the return value is NULL. If either argument is NULL or * asking for an unsupported SHA function, the return value is NULL. If either argument is NULL or
* the hash length is not one of the permitted values, the return value is NULL. * the hash length is not one of the permitted values, the return value is NULL.
*/ */
// scalastyle:off line.size.limit
@ExpressionDescription( @ExpressionDescription(
usage = usage = """_FUNC_(input, bitLength) - Returns a checksum of SHA-2 family as a hex string of the input.
"""_FUNC_(input, bitLength) - Returns a checksum of SHA-2 family as a hex string of the input. SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent to 256.""",
SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent to 256.""" extended = """> SELECT _FUNC_('Spark', 0);
, '529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b'""")
extended = "> SELECT _FUNC_('Spark', 0);\n " + // scalastyle:on line.size.limit
"'529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b'")
case class Sha2(left: Expression, right: Expression) case class Sha2(left: Expression, right: Expression)
extends BinaryExpression with Serializable with ImplicitCastInputTypes { extends BinaryExpression with Serializable with ImplicitCastInputTypes {
......
...@@ -366,8 +366,8 @@ abstract class OffsetWindowFunction ...@@ -366,8 +366,8 @@ abstract class OffsetWindowFunction
* @param default to use when the input value is null or when the offset is larger than the window. * @param default to use when the input value is null or when the offset is larger than the window.
*/ */
@ExpressionDescription(usage = @ExpressionDescription(usage =
"""_FUNC_(input, offset, default) - LEAD returns the value of 'x' at 'offset' rows after the """_FUNC_(input, offset, default) - LEAD returns the value of 'x' at 'offset' rows
current row in the window""") after the current row in the window""")
case class Lead(input: Expression, offset: Expression, default: Expression) case class Lead(input: Expression, offset: Expression, default: Expression)
extends OffsetWindowFunction { extends OffsetWindowFunction {
...@@ -393,8 +393,8 @@ case class Lead(input: Expression, offset: Expression, default: Expression) ...@@ -393,8 +393,8 @@ case class Lead(input: Expression, offset: Expression, default: Expression)
* @param default to use when the input value is null or when the offset is smaller than the window. * @param default to use when the input value is null or when the offset is smaller than the window.
*/ */
@ExpressionDescription(usage = @ExpressionDescription(usage =
"""_FUNC_(input, offset, default) - LAG returns the value of 'x' at 'offset' rows before the """_FUNC_(input, offset, default) - LAG returns the value of 'x' at 'offset' rows
current row in the window""") before the current row in the window""")
case class Lag(input: Expression, offset: Expression, default: Expression) case class Lag(input: Expression, offset: Expression, default: Expression)
extends OffsetWindowFunction { extends OffsetWindowFunction {
...@@ -446,9 +446,9 @@ object SizeBasedWindowFunction { ...@@ -446,9 +446,9 @@ object SizeBasedWindowFunction {
* This documentation has been based upon similar documentation for the Hive and Presto projects. * This documentation has been based upon similar documentation for the Hive and Presto projects.
*/ */
@ExpressionDescription(usage = @ExpressionDescription(usage =
"""_FUNC_() - The ROW_NUMBER() function assigns a unique, sequential """_FUNC_() - The ROW_NUMBER() function assigns a unique, sequential number to
number to each row, starting with one, according to the ordering of rows within the window each row, starting with one, according to the ordering of rows within
partition.""") the window partition.""")
case class RowNumber() extends RowNumberLike { case class RowNumber() extends RowNumberLike {
override val evaluateExpression = rowNumber override val evaluateExpression = rowNumber
} }
...@@ -462,8 +462,8 @@ case class RowNumber() extends RowNumberLike { ...@@ -462,8 +462,8 @@ case class RowNumber() extends RowNumberLike {
* This documentation has been based upon similar documentation for the Hive and Presto projects. * This documentation has been based upon similar documentation for the Hive and Presto projects.
*/ */
@ExpressionDescription(usage = @ExpressionDescription(usage =
"""_FUNC_() - The CUME_DIST() function computes the position of a value relative to a all values """_FUNC_() - The CUME_DIST() function computes the position of a value relative to
in the partition.""") a all values in the partition.""")
case class CumeDist() extends RowNumberLike with SizeBasedWindowFunction { case class CumeDist() extends RowNumberLike with SizeBasedWindowFunction {
override def dataType: DataType = DoubleType override def dataType: DataType = DoubleType
// The frame for CUME_DIST is Range based instead of Row based, because CUME_DIST must // The frame for CUME_DIST is Range based instead of Row based, because CUME_DIST must
...@@ -494,8 +494,8 @@ case class CumeDist() extends RowNumberLike with SizeBasedWindowFunction { ...@@ -494,8 +494,8 @@ case class CumeDist() extends RowNumberLike with SizeBasedWindowFunction {
* @param buckets number of buckets to divide the rows in. Default value is 1. * @param buckets number of buckets to divide the rows in. Default value is 1.
*/ */
@ExpressionDescription(usage = @ExpressionDescription(usage =
"""_FUNC_(x) - The NTILE(n) function divides the rows for each window partition into 'n' buckets """_FUNC_(x) - The NTILE(n) function divides the rows for each window partition
ranging from 1 to at most 'n'.""") into 'n' buckets ranging from 1 to at most 'n'.""")
case class NTile(buckets: Expression) extends RowNumberLike with SizeBasedWindowFunction { case class NTile(buckets: Expression) extends RowNumberLike with SizeBasedWindowFunction {
def this() = this(Literal(1)) def this() = this(Literal(1))
...@@ -602,9 +602,9 @@ abstract class RankLike extends AggregateWindowFunction { ...@@ -602,9 +602,9 @@ abstract class RankLike extends AggregateWindowFunction {
* Analyser. * Analyser.
*/ */
@ExpressionDescription(usage = @ExpressionDescription(usage =
"""_FUNC_() - RANK() computes the rank of a value in a group of values. The result is one plus """_FUNC_() - RANK() computes the rank of a value in a group of values. The result
the number of rows preceding or equal to the current row in the ordering of the partition. Tie is one plus the number of rows preceding or equal to the current row in the
values will produce gaps in the sequence.""") ordering of the partition. Tie values will produce gaps in the sequence.""")
case class Rank(children: Seq[Expression]) extends RankLike { case class Rank(children: Seq[Expression]) extends RankLike {
def this() = this(Nil) def this() = this(Nil)
override def withOrder(order: Seq[Expression]): Rank = Rank(order) override def withOrder(order: Seq[Expression]): Rank = Rank(order)
...@@ -622,9 +622,9 @@ case class Rank(children: Seq[Expression]) extends RankLike { ...@@ -622,9 +622,9 @@ case class Rank(children: Seq[Expression]) extends RankLike {
* Analyser. * Analyser.
*/ */
@ExpressionDescription(usage = @ExpressionDescription(usage =
"""_FUNC_() - The DENSE_RANK() function computes the rank of a value in a group of values. The """_FUNC_() - The DENSE_RANK() function computes the rank of a value in a group of
result is one plus the previously assigned rank value. Unlike Rank, DenseRank will not produce values. The result is one plus the previously assigned rank value. Unlike Rank,
gaps in the ranking sequence.""") DenseRank will not produce gaps in the ranking sequence.""")
case class DenseRank(children: Seq[Expression]) extends RankLike { case class DenseRank(children: Seq[Expression]) extends RankLike {
def this() = this(Nil) def this() = this(Nil)
override def withOrder(order: Seq[Expression]): DenseRank = DenseRank(order) override def withOrder(order: Seq[Expression]): DenseRank = DenseRank(order)
...@@ -649,8 +649,8 @@ case class DenseRank(children: Seq[Expression]) extends RankLike { ...@@ -649,8 +649,8 @@ case class DenseRank(children: Seq[Expression]) extends RankLike {
* Analyser. * Analyser.
*/ */
@ExpressionDescription(usage = @ExpressionDescription(usage =
"""_FUNC_() - PERCENT_RANK() The PercentRank function computes the percentage ranking of a value """_FUNC_() - PERCENT_RANK() The PercentRank function computes the percentage
in a group of values.""") ranking of a value in a group of values.""")
case class PercentRank(children: Seq[Expression]) extends RankLike with SizeBasedWindowFunction { case class PercentRank(children: Seq[Expression]) extends RankLike with SizeBasedWindowFunction {
def this() = this(Nil) def this() = this(Nil)
override def withOrder(order: Seq[Expression]): PercentRank = PercentRank(order) override def withOrder(order: Seq[Expression]): PercentRank = PercentRank(order)
......
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