Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Simplify expressions
  • Loading branch information
planga82 committed May 14, 2021
commit c123599da608adf219304b1409279abfd38b114c
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