-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-23299][SQL][PYSPARK] Fix __repr__ behaviour for Rows. #20503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,6 +234,10 @@ def test_empty_row(self): | |
| row = Row() | ||
| self.assertEqual(len(row), 0) | ||
|
|
||
| def test_row_without_column_name(self): | ||
| row = Row("Alice", 11) | ||
| self.assertEqual(row.__repr__(), "<Row(Alice, 11)>") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would test non-ascii compatible characters as well |
||
|
|
||
| def test_struct_field_type_name(self): | ||
| struct_field = StructField("a", IntegerType()) | ||
| self.assertRaises(TypeError, struct_field.typeName) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1581,7 +1581,7 @@ def __repr__(self): | |
| return "Row(%s)" % ", ".join("%s=%r" % (k, v) | ||
| for k, v in zip(self.__fields__, tuple(self))) | ||
| else: | ||
| return "<Row(%s)>" % ", ".join(self) | ||
| return "<Row(%s)>" % ", ".join("%s" % (fields) for fields in self) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit fields => field
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| class DateConverter(object): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a doctest for this usage (Row as objects not as a namedtuple class), and documentation in
Rowattypes.py?