Skip to content

Commit f4c725c

Browse files
committed
minor code style fix
1 parent 25425ac commit f4c725c

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/functions.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,15 @@ abstract class StddevAgg(child: Expression) extends AlgebraicAggregate {
302302
private val currentAvg = AttributeReference("currentAvg", resultType)()
303303
private val currentMk = AttributeReference("currentMk", resultType)()
304304

305-
override val bufferAttributes = preCount :: currentCount :: preAvg :: currentAvg :: currentMk :: Nil
305+
override val bufferAttributes = preCount :: currentCount :: preAvg ::
306+
currentAvg :: currentMk :: Nil
306307

307308
override val initialValues = Seq(
308-
/* preCount = */ Cast(Literal(0), resultType),
309+
/* preCount = */ Cast(Literal(0), resultType),
309310
/* currentCount = */ Cast(Literal(0), resultType),
310-
/* preAvg = */ Cast(Literal(0), resultType),
311-
/* currentAvg = */ Cast(Literal(0), resultType),
312-
/* currentMk = */ Cast(Literal(0), resultType)
311+
/* preAvg = */ Cast(Literal(0), resultType),
312+
/* currentAvg = */ Cast(Literal(0), resultType),
313+
/* currentMk = */ Cast(Literal(0), resultType)
313314
)
314315

315316
override val updateExpressions = {
@@ -330,16 +331,17 @@ abstract class StddevAgg(child: Expression) extends AlgebraicAggregate {
330331

331332
Seq(
332333
/* preCount = */ If(IsNull(child), preCount, currentCount),
333-
/* currentCount = */ If(IsNull(child), currentCount, Add(currentCount, Cast(Literal(1), resultType))),
334+
/* currentCount = */ If(IsNull(child), currentCount,
335+
Add(currentCount, Cast(Literal(1), resultType))),
334336
/* preAvg = */ If(IsNull(child), preAvg, currentAvg),
335337
/* currentAvg = */ If(IsNull(child), currentAvg, avgAdd),
336338
/* currentMk = */ If(IsNull(child), currentMk, mkAdd)
337339
)
338340
}
339341

340342
override val mergeExpressions = {
341-
342-
//count merge
343+
344+
// count merge
343345
def countMerge: Expression = {
344346
currentCount.left + currentCount.right
345347
}

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ abstract class StddevAgg1(child: Expression) extends UnaryExpression with Partia
702702
case _ => DoubleType
703703
}
704704

705-
def isSample: Boolean
705+
def isSample: Boolean
706706

707707
override def asPartial: SplitEvaluation = {
708708
val partialStd = Alias(ComputePartialStd(child), "PartialStddev")()
@@ -803,8 +803,11 @@ case class ComputePartialStdFunction (
803803
}
804804
}
805805

806-
case class MergePartialStd(child: Expression, isSample: Boolean) extends UnaryExpression with AggregateExpression1 {
807-
def this() = this(null, false) //required for serialization
806+
case class MergePartialStd(
807+
child: Expression,
808+
isSample: Boolean
809+
) extends UnaryExpression with AggregateExpression1 {
810+
def this() = this(null, false) // required for serialization
808811

809812
override def children: Seq[Expression] = child:: Nil
810813
override def nullable: Boolean = false
@@ -937,11 +940,11 @@ case class StddevFunction(
937940
if (curCount == 0) null
938941
else if (curCount < 2) zero.eval(null)
939942
else {
940-
// when total count > 2,
943+
// when total count > 2,
941944
// stddev_samp = sqrt(curMk/(curCount - 1))
942945
// stddev_pop = sqrt(curMk/curCount)
943946
val varCol = {
944-
if(isSample) {
947+
if (isSample) {
945948
Divide(curMk, Cast(Literal(curCount - 1), computeType))
946949
}
947950
else {

0 commit comments

Comments
 (0)