Skip to content

Commit 1667604

Browse files
author
Davies Liu
committed
fix style and add comment
1 parent 5f8c0fd commit 1667604

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ case class AverageFunction(expr: Expression, base: AggregateExpression)
505505
private var count: Long = _
506506
private val sum = MutableLiteral(zero.eval(null), calcType)
507507

508-
private def addFunction(value: Any) = Add(sum, Cast(Literal.create(value, expr.dataType), calcType))
508+
private def addFunction(value: Any) = Add(sum,
509+
Cast(Literal.create(value, expr.dataType), calcType))
509510

510511
override def eval(input: Row): Any = {
511512
if (count == 0L) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ object IntegerLiteral {
6464
}
6565
}
6666

67+
/**
68+
* In order to do type checking, use Literal.create() instead of constructor
69+
*/
6770
case class Literal protected (value: Any, dataType: DataType) extends LeafExpression {
6871

6972
override def foldable: Boolean = true

sql/core/src/main/scala/org/apache/spark/sql/parquet/newParquet.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,8 @@ private[sql] object ParquetRelation2 extends Logging {
961961
.orElse(Try(Literal.create(new JBigDecimal(raw), DecimalType.Unlimited)))
962962
// Then falls back to string
963963
.getOrElse {
964-
if (raw == defaultPartitionName) Literal.create(null, NullType) else Literal.create(raw, StringType)
964+
if (raw == defaultPartitionName) Literal.create(null, NullType)
965+
else Literal.create(raw, StringType)
965966
}
966967
}
967968

0 commit comments

Comments
 (0)