Skip to content

Commit

Permalink
rename to fromLiteral
Browse files Browse the repository at this point in the history
  • Loading branch information
mgaido91 committed Jan 17, 2018
1 parent 7653e6d commit 2b66098
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ object DecimalPrecision extends TypeCoercionRule {
// become DECIMAL(38, 16), safely having a much lower precision loss.
case (l: Literal, r) if r.dataType.isInstanceOf[DecimalType]
&& l.dataType.isInstanceOf[IntegralType] =>
b.makeCopy(Array(Cast(l, DecimalType.forLiteral(l)), r))
b.makeCopy(Array(Cast(l, DecimalType.fromLiteral(l)), r))
case (l, r: Literal) if l.dataType.isInstanceOf[DecimalType]
&& r.dataType.isInstanceOf[IntegralType] =>
b.makeCopy(Array(l, Cast(r, DecimalType.forLiteral(r))))
b.makeCopy(Array(l, Cast(r, DecimalType.fromLiteral(r))))
// Promote integers inside a binary expression with fixed-precision decimals to decimals,
// and fixed-precision decimals in an expression with floats / doubles to doubles
case (l @ IntegralType(), r @ DecimalType.Expression(_, _)) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ object DecimalType extends AbstractDataType {
case DoubleType => DoubleDecimal
}

private[sql] def forLiteral(literal: Literal): DecimalType = literal.value match {
private[sql] def fromLiteral(literal: Literal): DecimalType = literal.value match {
case v: Short => fromBigDecimal(BigDecimal(v))
case v: Int => fromBigDecimal(BigDecimal(v))
case v: Long => fromBigDecimal(BigDecimal(v))
Expand Down

0 comments on commit 2b66098

Please sign in to comment.