Github user HyukjinKwon commented on the issue:
https://github.com/apache/spark/pull/20499
I think it's a bug fix. For the context,
1. the dictionary support was added but `value` was required (and ignored)
at the first place
[SPARK-6876](https://issues.apache.org/jira/browse/SPARK-6876):
```python
df.replace({"Alice": "Bob"}, value=1).show()
```
2. `value=None` was added to allow the case below
[SPARK-19454](https://issues.apache.org/jira/browse/SPARK-19454):
```python
df.replace({"Alice": "Bob"}).show()
```
but it happened to allow the case below too:
```
df.replace("Alice").show()
```
3. `df.na.replace` is an alias of `df.replace`. So, it has the same default
value `value=None`
[SPARK-21658](https://issues.apache.org/jira/browse/SPARK-21658):
```python
df.replace({"Alice": "Bob"}).show()
```
4. An design issue was raised in
[SPARK-21658](https://issues.apache.org/jira/browse/SPARK-21658) and
https://github.com/apache/spark/pull/16793#issuecomment-362684399
([SPARK-19454](https://issues.apache.org/jira/browse/SPARK-19454)).
To cut it short, I think the issue raised is basically that the case
below is weird:
```python
df.replace("Alice").show()
```
5. [SPARK-21658](https://issues.apache.org/jira/browse/SPARK-21658) was
reverted.
5. This PR deals tries to throw an exception in 4. case, and also deals
with [SPARK-21658](https://issues.apache.org/jira/browse/SPARK-21658)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]