Skip to content

Commit 655e115

Browse files
committed
address review comment
1 parent 9a15ba2 commit 655e115

File tree

1 file changed

+4
-2
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/types

1 file changed

+4
-2
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ final class Decimal extends Ordered[Decimal] with Serializable {
132132
}
133133

134134
/**
135-
* Set this Decimal to the given BigInteger value. Will have precision 38 and scale 0.
135+
* Set this Decimal to the given BigInteger value. Will have precision 38 and scale 0
136+
* if value is fit into long value range. Otherwise, use BigDecimal
137+
*
138+
* This code avoids BigDecimal object allocation as possible to improve runtime efficiency
136139
*/
137140
def set(bigintval: BigInteger): Decimal = {
138141
try {
@@ -144,7 +147,6 @@ final class Decimal extends Ordered[Decimal] with Serializable {
144147
} catch {
145148
case _: ArithmeticException =>
146149
set(BigDecimal(bigintval))
147-
this
148150
}
149151
}
150152

0 commit comments

Comments
 (0)