aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorKazuaki Ishizaki <ishizaki@jp.ibm.com>2016-01-07 13:56:34 -0800
committerYin Huai <yhuai@databricks.com>2016-01-07 13:56:34 -0800
commit34dbc8af21da63702bc0694d471fbfee4cd08dda (patch)
tree3edba216a79d880420e8ccbb74b5904c03b27b69 /sql
parent8346518357f4a3565ae41e9a5ccd7e2c3ed6c468 (diff)
downloadspark-34dbc8af21da63702bc0694d471fbfee4cd08dda.tar.gz
spark-34dbc8af21da63702bc0694d471fbfee4cd08dda.tar.bz2
spark-34dbc8af21da63702bc0694d471fbfee4cd08dda.zip
[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.
Diffstat (limited to 'sql')
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala12
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala38
2 files changed, 25 insertions, 25 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
index 6697d46361..fd95b124b2 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
@@ -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
* the hash length is not one of the permitted values, the return value is NULL.
*/
+// scalastyle:off line.size.limit
@ExpressionDescription(
- usage =
- """_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."""
- ,
- extended = "> SELECT _FUNC_('Spark', 0);\n " +
- "'529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b'")
+ usage = """_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.""",
+ extended = """> SELECT _FUNC_('Spark', 0);
+ '529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b'""")
+// scalastyle:on line.size.limit
case class Sha2(left: Expression, right: Expression)
extends BinaryExpression with Serializable with ImplicitCastInputTypes {
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
index 3934e33628..afe122f6a0 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
@@ -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.
*/
@ExpressionDescription(usage =
- """_FUNC_(input, offset, default) - LEAD returns the value of 'x' at 'offset' rows after the
- current row in the window""")
+ """_FUNC_(input, offset, default) - LEAD returns the value of 'x' at 'offset' rows
+ after the current row in the window""")
case class Lead(input: Expression, offset: Expression, default: Expression)
extends OffsetWindowFunction {
@@ -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.
*/
@ExpressionDescription(usage =
- """_FUNC_(input, offset, default) - LAG returns the value of 'x' at 'offset' rows before the
- current row in the window""")
+ """_FUNC_(input, offset, default) - LAG returns the value of 'x' at 'offset' rows
+ before the current row in the window""")
case class Lag(input: Expression, offset: Expression, default: Expression)
extends OffsetWindowFunction {
@@ -446,9 +446,9 @@ object SizeBasedWindowFunction {
* This documentation has been based upon similar documentation for the Hive and Presto projects.
*/
@ExpressionDescription(usage =
- """_FUNC_() - The ROW_NUMBER() function assigns a unique, sequential
- number to each row, starting with one, according to the ordering of rows within the window
- partition.""")
+ """_FUNC_() - The ROW_NUMBER() function assigns a unique, sequential number to
+ each row, starting with one, according to the ordering of rows within
+ the window partition.""")
case class RowNumber() extends RowNumberLike {
override val evaluateExpression = rowNumber
}
@@ -462,8 +462,8 @@ case class RowNumber() extends RowNumberLike {
* This documentation has been based upon similar documentation for the Hive and Presto projects.
*/
@ExpressionDescription(usage =
- """_FUNC_() - The CUME_DIST() function computes the position of a value relative to a all values
- in the partition.""")
+ """_FUNC_() - The CUME_DIST() function computes the position of a value relative to
+ a all values in the partition.""")
case class CumeDist() extends RowNumberLike with SizeBasedWindowFunction {
override def dataType: DataType = DoubleType
// 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 {
* @param buckets number of buckets to divide the rows in. Default value is 1.
*/
@ExpressionDescription(usage =
- """_FUNC_(x) - The NTILE(n) function divides the rows for each window partition into 'n' buckets
- ranging from 1 to at most 'n'.""")
+ """_FUNC_(x) - The NTILE(n) function divides the rows for each window partition
+ into 'n' buckets ranging from 1 to at most 'n'.""")
case class NTile(buckets: Expression) extends RowNumberLike with SizeBasedWindowFunction {
def this() = this(Literal(1))
@@ -602,9 +602,9 @@ abstract class RankLike extends AggregateWindowFunction {
* Analyser.
*/
@ExpressionDescription(usage =
- """_FUNC_() - RANK() computes the rank of a value in a group of values. The result is one plus
- the number of rows preceding or equal to the current row in the ordering of the partition. Tie
- values will produce gaps in the sequence.""")
+ """_FUNC_() - RANK() computes the rank of a value in a group of values. The result
+ is one plus the number of rows preceding or equal to the current row in the
+ ordering of the partition. Tie values will produce gaps in the sequence.""")
case class Rank(children: Seq[Expression]) extends RankLike {
def this() = this(Nil)
override def withOrder(order: Seq[Expression]): Rank = Rank(order)
@@ -622,9 +622,9 @@ case class Rank(children: Seq[Expression]) extends RankLike {
* Analyser.
*/
@ExpressionDescription(usage =
- """_FUNC_() - The DENSE_RANK() function computes the rank of a value in a group of values. The
- result is one plus the previously assigned rank value. Unlike Rank, DenseRank will not produce
- gaps in the ranking sequence.""")
+ """_FUNC_() - The DENSE_RANK() function computes the rank of a value in a group of
+ values. The result is one plus the previously assigned rank value. Unlike Rank,
+ DenseRank will not produce gaps in the ranking sequence.""")
case class DenseRank(children: Seq[Expression]) extends RankLike {
def this() = this(Nil)
override def withOrder(order: Seq[Expression]): DenseRank = DenseRank(order)
@@ -649,8 +649,8 @@ case class DenseRank(children: Seq[Expression]) extends RankLike {
* Analyser.
*/
@ExpressionDescription(usage =
- """_FUNC_() - PERCENT_RANK() The PercentRank function computes the percentage ranking of a value
- in a group of values.""")
+ """_FUNC_() - PERCENT_RANK() The PercentRank function computes the percentage
+ ranking of a value in a group of values.""")
case class PercentRank(children: Seq[Expression]) extends RankLike with SizeBasedWindowFunction {
def this() = this(Nil)
override def withOrder(order: Seq[Expression]): PercentRank = PercentRank(order)