c27kwan commented on code in PR #37771:
URL: https://github.com/apache/spark/pull/37771#discussion_r963024550
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/ArrayBasedMapData.scala:
##########
@@ -35,6 +37,29 @@ class ArrayBasedMapData(val keyArray: ArrayData, val
valueArray: ArrayData) exte
override def toString: String = {
s"keys: $keyArray, values: $valueArray"
}
+
+ override def equals(obj: Any): Boolean = {
+ if (obj == null && this == null) {
+ return true
+ }
+
+ if (obj == null || !obj.isInstanceOf[ArrayBasedMapData]) {
+ return false
+ }
+
+ val other = obj.asInstanceOf[ArrayBasedMapData]
+
+ keyArray.equals(other.keyArray) && valueArray.equals(other.valueArray)
+ }
Review Comment:
The `ArrayBasedMapData` `equals` check in `Literal`s does a `==` check
between the `keyArray` and the `valueArray`:
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala#L377-L390
To be consistent, I'll change it to use `==`
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/ArrayBasedMapData.scala:
##########
@@ -35,6 +37,29 @@ class ArrayBasedMapData(val keyArray: ArrayData, val
valueArray: ArrayData) exte
override def toString: String = {
s"keys: $keyArray, values: $valueArray"
}
+
+ override def equals(obj: Any): Boolean = {
+ if (obj == null && this == null) {
Review Comment:
You're right, `this` can't be null. I'll remove this check.
The IDEA defaults in this case are not super helpful because they just defer
to the parent class `super.equals(obj)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]