Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/18820#discussion_r132104328
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameNaFunctionsSuite.scala ---
@@ -261,5 +261,37 @@ class DataFrameNaFunctionsSuite extends QueryTest with
SharedSQLContext {
assert(out1(3).get(2).asInstanceOf[Double].isNaN)
assert(out1(4) === Row("Amy", null, null))
assert(out1(5) === Row(null, null, null))
+
+ // Replace String with String and null
+ val out2 = input.na.replace("name", Map(
+ "Bob" -> "Bravo",
+ "Alice" -> null
+ )).collect()
+
+ assert(out2(0) === Row("Bravo", 16, 176.5))
+ assert(out2(1) === Row(null, null, 164.3))
+ assert(out2(2) === Row("David", 60, null))
+ assert(out2(3).get(2).asInstanceOf[Double].isNaN)
+ assert(out2(4) === Row("Amy", null, null))
+ assert(out2(5) === Row(null, null, null))
+
+ // Replace Double with null
--- End diff --
Also add a test case for boolean
---
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]