Skip to content

Commit 34dbc8a

Browse files
kiszkyhuai
authored andcommitted
[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 #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 <[email protected]> Closes #10524 from kiszk/SPARK-12580.
1 parent 8346518 commit 34dbc8a

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ case class Md5(child: Expression) extends UnaryExpression with ImplicitCastInput
5858
* asking for an unsupported SHA function, the return value is NULL. If either argument is NULL or
5959
* the hash length is not one of the permitted values, the return value is NULL.
6060
*/
61+
// scalastyle:off line.size.limit
6162
@ExpressionDescription(
62-
usage =
63-
"""_FUNC_(input, bitLength) - Returns a checksum of SHA-2 family as a hex string of the input.
64-
SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent to 256."""
65-
,
66-
extended = "> SELECT _FUNC_('Spark', 0);\n " +
67-
"'529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b'")
63+
usage = """_FUNC_(input, bitLength) - Returns a checksum of SHA-2 family as a hex string of the input.
64+
SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent to 256.""",
65+
extended = """> SELECT _FUNC_('Spark', 0);
66+
'529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b'""")
67+
// scalastyle:on line.size.limit
6868
case class Sha2(left: Expression, right: Expression)
6969
extends BinaryExpression with Serializable with ImplicitCastInputTypes {
7070

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ abstract class OffsetWindowFunction
366366
* @param default to use when the input value is null or when the offset is larger than the window.
367367
*/
368368
@ExpressionDescription(usage =
369-
"""_FUNC_(input, offset, default) - LEAD returns the value of 'x' at 'offset' rows after the
370-
current row in the window""")
369+
"""_FUNC_(input, offset, default) - LEAD returns the value of 'x' at 'offset' rows
370+
after the current row in the window""")
371371
case class Lead(input: Expression, offset: Expression, default: Expression)
372372
extends OffsetWindowFunction {
373373

@@ -393,8 +393,8 @@ case class Lead(input: Expression, offset: Expression, default: Expression)
393393
* @param default to use when the input value is null or when the offset is smaller than the window.
394394
*/
395395
@ExpressionDescription(usage =
396-
"""_FUNC_(input, offset, default) - LAG returns the value of 'x' at 'offset' rows before the
397-
current row in the window""")
396+
"""_FUNC_(input, offset, default) - LAG returns the value of 'x' at 'offset' rows
397+
before the current row in the window""")
398398
case class Lag(input: Expression, offset: Expression, default: Expression)
399399
extends OffsetWindowFunction {
400400

@@ -446,9 +446,9 @@ object SizeBasedWindowFunction {
446446
* This documentation has been based upon similar documentation for the Hive and Presto projects.
447447
*/
448448
@ExpressionDescription(usage =
449-
"""_FUNC_() - The ROW_NUMBER() function assigns a unique, sequential
450-
number to each row, starting with one, according to the ordering of rows within the window
451-
partition.""")
449+
"""_FUNC_() - The ROW_NUMBER() function assigns a unique, sequential number to
450+
each row, starting with one, according to the ordering of rows within
451+
the window partition.""")
452452
case class RowNumber() extends RowNumberLike {
453453
override val evaluateExpression = rowNumber
454454
}
@@ -462,8 +462,8 @@ case class RowNumber() extends RowNumberLike {
462462
* This documentation has been based upon similar documentation for the Hive and Presto projects.
463463
*/
464464
@ExpressionDescription(usage =
465-
"""_FUNC_() - The CUME_DIST() function computes the position of a value relative to a all values
466-
in the partition.""")
465+
"""_FUNC_() - The CUME_DIST() function computes the position of a value relative to
466+
a all values in the partition.""")
467467
case class CumeDist() extends RowNumberLike with SizeBasedWindowFunction {
468468
override def dataType: DataType = DoubleType
469469
// 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 {
494494
* @param buckets number of buckets to divide the rows in. Default value is 1.
495495
*/
496496
@ExpressionDescription(usage =
497-
"""_FUNC_(x) - The NTILE(n) function divides the rows for each window partition into 'n' buckets
498-
ranging from 1 to at most 'n'.""")
497+
"""_FUNC_(x) - The NTILE(n) function divides the rows for each window partition
498+
into 'n' buckets ranging from 1 to at most 'n'.""")
499499
case class NTile(buckets: Expression) extends RowNumberLike with SizeBasedWindowFunction {
500500
def this() = this(Literal(1))
501501

@@ -602,9 +602,9 @@ abstract class RankLike extends AggregateWindowFunction {
602602
* Analyser.
603603
*/
604604
@ExpressionDescription(usage =
605-
"""_FUNC_() - RANK() computes the rank of a value in a group of values. The result is one plus
606-
the number of rows preceding or equal to the current row in the ordering of the partition. Tie
607-
values will produce gaps in the sequence.""")
605+
"""_FUNC_() - RANK() computes the rank of a value in a group of values. The result
606+
is one plus the number of rows preceding or equal to the current row in the
607+
ordering of the partition. Tie values will produce gaps in the sequence.""")
608608
case class Rank(children: Seq[Expression]) extends RankLike {
609609
def this() = this(Nil)
610610
override def withOrder(order: Seq[Expression]): Rank = Rank(order)
@@ -622,9 +622,9 @@ case class Rank(children: Seq[Expression]) extends RankLike {
622622
* Analyser.
623623
*/
624624
@ExpressionDescription(usage =
625-
"""_FUNC_() - The DENSE_RANK() function computes the rank of a value in a group of values. The
626-
result is one plus the previously assigned rank value. Unlike Rank, DenseRank will not produce
627-
gaps in the ranking sequence.""")
625+
"""_FUNC_() - The DENSE_RANK() function computes the rank of a value in a group of
626+
values. The result is one plus the previously assigned rank value. Unlike Rank,
627+
DenseRank will not produce gaps in the ranking sequence.""")
628628
case class DenseRank(children: Seq[Expression]) extends RankLike {
629629
def this() = this(Nil)
630630
override def withOrder(order: Seq[Expression]): DenseRank = DenseRank(order)
@@ -649,8 +649,8 @@ case class DenseRank(children: Seq[Expression]) extends RankLike {
649649
* Analyser.
650650
*/
651651
@ExpressionDescription(usage =
652-
"""_FUNC_() - PERCENT_RANK() The PercentRank function computes the percentage ranking of a value
653-
in a group of values.""")
652+
"""_FUNC_() - PERCENT_RANK() The PercentRank function computes the percentage
653+
ranking of a value in a group of values.""")
654654
case class PercentRank(children: Seq[Expression]) extends RankLike with SizeBasedWindowFunction {
655655
def this() = this(Nil)
656656
override def withOrder(order: Seq[Expression]): PercentRank = PercentRank(order)

0 commit comments

Comments
 (0)