ahshahid commented on code in PR #49153:
URL: https://github.com/apache/spark/pull/49153#discussion_r2098193950
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryBaseTable.scala:
##########
@@ -491,6 +492,16 @@ abstract class InMemoryBaseTable(
}
}
}
+
+ override def equals(other: Any): Boolean = other match {
+ case imbs: InMemoryBatchScan => this.readSchema == imbs.readSchema &&
Review Comment:
Hi @li-boxuan ,
In most of the cases, the spark classes are case classes of scala and
usually its not recommended to override equals and hashCode of case classes,
unless there is a specific requirement ( like you want to exclude certain
member fields from equality check or need to do special handling ).
As for the reason why there is no
case imbs: InMemoryBatchScan => this.getClass == imbs.getClass &&
is because that its already getting accomplished.
The code snippet here implies that the "this" instance **is**
InMemoryBatchScan ( because we are in its equal's method), and the **case
imbs: InMemoryBatchScan** ensures that "other" is also of type
InMemoryBatchScan.
which accomplishes what you are hinting at.
Regarding the issue which you are hitting , that would be possible only in
those cases where the Spark Operator classes are not case classes (& there are
only some exceptions) and case classes cannot get extended , right?
So if you provide some more details as to where the match is happening
incorrectly , may shed some more light on the issue.
--
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]