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

    https://github.com/apache/spark/pull/17056#discussion_r103618852
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/hash.scala
 ---
    @@ -732,6 +743,51 @@ object HiveHashFunction extends 
InterpretedHashFunction {
         HiveHasher.hashUnsafeBytes(base, offset, len)
       }
     
    +  private val HiveDecimalMaxPrecision = 38
    +  private val HiveDecimalMaxScale = 38
    +
    +  // Mimics normalization done for decimals in Hive at 
HiveDecimalV1.normalize()
    +  def normalizeDecimal(input: BigDecimal, allowRounding: Boolean): 
BigDecimal = {
    +    if (input == null) {
    +      return null
    +    }
    +
    +    def trimDecimal(input: BigDecimal) = {
    +      var result = input
    +      if (result.compareTo(BigDecimal.ZERO) == 0) {
    +        // Special case for 0, because java doesn't strip zeros correctly 
on that number.
    +        result = BigDecimal.ZERO
    +      }
    +      else {
    --- End diff --
    
    changed


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to