Skip to content

Commit

Permalink
fix NaN and equality issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dongjoon-hyun committed Nov 23, 2020
1 parent eb19da4 commit 7214398
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ case class Literal (value: Any, dataType: DataType) extends LeafExpression {
case (a: Array[Byte], b: Array[Byte]) => util.Arrays.equals(a, b)
case (a: ArrayBasedMapData, b: ArrayBasedMapData) =>
a.keyArray == b.keyArray && a.valueArray == b.valueArray
case (a: Double, b: Double) if a.isNaN && b.isNaN => true
case (a: Float, b: Float) if a.isNaN && b.isNaN => true
case (a, b) => a != null && a == b
}
case _ => false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class GenericArrayData(val array: Array[Any]) extends ArrayData {
if (!o2.isInstanceOf[Double] || ! java.lang.Double.isNaN(o2.asInstanceOf[Double])) {
return false
}
case _ => if (o1 != o2) {
case _ => if (o1.getClass != o2.getClass || o1 != o2) {
return false
}
}
Expand Down

0 comments on commit 7214398

Please sign in to comment.