From 111c05538d9dcee06e918dcd4481104ace712dc3 Mon Sep 17 00:00:00 2001 From: Reynold Xin Date: Thu, 16 Jul 2015 23:13:06 -0700 Subject: Added inline comment for the canEqual PR by @cloud-fan. --- sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala index 5f0592dc1d..3623fefbf2 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala @@ -364,8 +364,13 @@ trait Row extends Serializable { false } - protected def canEqual(other: Any) = + protected def canEqual(other: Any) = { + // Note that InternalRow overrides canEqual. These two canEqual's together makes sure that + // comparing the external Row and InternalRow will always yield false. + // In the future, InternalRow should not extend Row. In that case, we can remove these + // canEqual methods. other.isInstanceOf[Row] && !other.isInstanceOf[InternalRow] + } override def equals(o: Any): Boolean = { if (o == null || !canEqual(o)) return false -- cgit v1.2.3