Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/12470#discussion_r60103407
--- Diff: python/pyspark/sql/types.py ---
@@ -1448,6 +1448,54 @@ def __repr__(self):
else:
return "<Row(%s)>" % ", ".join(self)
+ def __eq__(self, other):
+ """
+ Test for equality with `other`.
+
+ :param other: other Row for comparison
+
+ >>> Row(name="Alice", age=11) == Row(age=11, name="Alice")
+ True
+ >>> R1 = Row('a', 'b')
+ >>> R2 = Row('b', 'a')
+ >>> R1(1, 2) == R2(2, 1)
--- End diff --
Row is not an dictionary, I'd like to return False in this case, because
the schema is different.
Right now, Row is more close to namedtuple.
```python
>>> namedtuple("A", "a b")(1, 2) == namedtuple("B", "b a")(2, 1)
```
False
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]