Github user bravo-zhang commented on the issue:

    https://github.com/apache/spark/pull/18820
  
    Hi @HyukjinKwon @gatorsmile @viirya I addressed your comments, added more 
test coverage and provided more info in PR description.
    One thing that is not clear to user is that they can still use 
`df.na.replace("*", Map(10 -> 20, "Alpha" -> "Bravo"))`. The behavior is that 
only fields that have same type as the 1st key in the replacement map will 
perform replacement(so `"Alpha" -> "Bravo"` doesn't have effect). This is due 
to the implementation of `targetColumnType`. This also creates a discrepancy 
that in Python we check all keys and values should be of same type while in 
Scala we don't check. This behavior exists before this PR.
    I added 1 line comment `// Only fields of targetColumnType will perform 
replacement.` Is it enough for now? If we are to make it more elegant, is it a 
valid task to accept any replacement map so long as each key-value pair has the 
same type?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to