Skip to content

Commit

Permalink
Simplify expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
planga82 committed May 14, 2021
1 parent 869ae7c commit c123599
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ abstract class HashExpression[E] extends Expression {
protected def genHashFloat(input: String, result: String): String = {
s"""
|if($input == -0.0f) {
| ${genHashInt(s"Float.floatToIntBits(0.0f)", result)}
| ${genHashInt("0", result)}
|} else {
| ${genHashInt(s"Float.floatToIntBits($input)", result)}
|}
Expand All @@ -382,7 +382,7 @@ abstract class HashExpression[E] extends Expression {
protected def genHashDouble(input: String, result: String): String = {
s"""
|if($input == -0.0d) {
| ${genHashLong(s"Double.doubleToLongBits(0.0d)", result)}
| ${genHashLong("0L", result)}
|} else {
| ${genHashLong(s"Double.doubleToLongBits($input)", result)}
|}
Expand Down Expand Up @@ -537,9 +537,9 @@ abstract class InterpretedHashFunction {
case s: Short => hashInt(s, seed)
case i: Int => hashInt(i, seed)
case l: Long => hashLong(l, seed)
case f: Float if (f == -0.0f) => hashInt(java.lang.Float.floatToIntBits(0.0f), seed)
case f: Float if (f == -0.0f) => hashInt(0, seed)
case f: Float => hashInt(java.lang.Float.floatToIntBits(f), seed)
case d: Double if (d == -0.0d) => hashLong(java.lang.Double.doubleToLongBits(0.0d), seed)
case d: Double if (d == -0.0d) => hashLong(0L, seed)
case d: Double => hashLong(java.lang.Double.doubleToLongBits(d), seed)
case d: Decimal =>
val precision = dataType.asInstanceOf[DecimalType].precision
Expand Down

0 comments on commit c123599

Please sign in to comment.