Skip to content

Comments

[SPARK-44643][SQL][PYTHON] Fix Row.__repr__ for the case the field is empty Row#42303

Closed
ueshin wants to merge 2 commits intoapache:masterfrom
ueshin:issues/SPARK-44643/repr_row
Closed

[SPARK-44643][SQL][PYTHON] Fix Row.__repr__ for the case the field is empty Row#42303
ueshin wants to merge 2 commits intoapache:masterfrom
ueshin:issues/SPARK-44643/repr_row

Conversation

@ueshin
Copy link
Member

@ueshin ueshin commented Aug 2, 2023

What changes were proposed in this pull request?

Fix Row.__repr__ for the case the field is empty Row.

>>> repr(Row(Row()))
'<Row(<Row()>)>'

Why are the changes needed?

Row.__repr__ is broken when it contains an empty Row:

>>> repr(Row(Row()))
Traceback (most recent call last):
...
TypeError: not enough arguments for format string

Does this PR introduce any user-facing change?

Row that contains an empty Row will be shown in the REPL.

How was this patch tested?

Added the related test.

@ueshin
Copy link
Member Author

ueshin commented Aug 2, 2023

cc @HyukjinKwon @zhengruifeng

@HyukjinKwon
Copy link
Member

Merged to master and branch-3.5.

HyukjinKwon pushed a commit that referenced this pull request Aug 3, 2023
… empty Row

### What changes were proposed in this pull request?

Fix `Row.__repr__` for the case the field is empty `Row`.

```py
>>> repr(Row(Row()))
'<Row(<Row()>)>'
```

### Why are the changes needed?

`Row.__repr__` is broken when it contains an empty `Row`:

```py
>>> repr(Row(Row()))
Traceback (most recent call last):
...
TypeError: not enough arguments for format string
```

### Does this PR introduce _any_ user-facing change?

`Row` that contains an empty `Row` will be shown in the REPL.

### How was this patch tested?

Added the related test.

Closes #42303 from ueshin/issues/SPARK-44643/repr_row.

Authored-by: Takuya UESHIN <ueshin@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit 8a84718)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants