Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8018#discussion_r36581563
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala ---
    @@ -61,68 +52,52 @@ final class Decimal extends Ordered[Decimal] with 
Serializable {
        * Set this Decimal to the given Int. Will have precision 10 and scale 0.
        */
       def set(intVal: Int): Decimal = {
    -    this.decimalVal = null
    -    this.longVal = intVal
    -    this._precision = 10
    -    this._scale = 0
    +    decimalVal = JavaBigDecimal.valueOf(intVal)
    +    _precision = 10
         this
       }
     
       /**
        * Set this Decimal to the given unscaled Long, with a given precision 
and scale.
    +   *
    +   * Note: this is used in serialization, caller will make sure that it 
will not overflow
        */
       def set(unscaled: Long, precision: Int, scale: Int): Decimal = {
    -    if (setOrNull(unscaled, precision, scale) == null) {
    --- End diff --
    
    Do you think that we should replace this old check with an assert, just to 
be safe / guard against mistakes made by the caller?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to