Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/13990#discussion_r69777386
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala ---
@@ -404,4 +404,26 @@ class DataFrameFunctionsSuite extends QueryTest with
SharedSQLContext {
Seq(Row(true), Row(true))
)
}
+
+ test("str_to_map function") {
+ val df1 = Seq(
+ ("a=1,b=2", "y"),
+ ("a=1,b=2,c=3", "y")
+ ).toDF("a", "b")
+
+ checkAnswer(
+ df1.selectExpr("str_to_map(a,',','=')"),
+ Seq(
+ Row(Map("a" -> "1", "b" -> "2")),
+ Row(Map("a" -> "1", "b" -> "2", "c" -> "3"))
+ )
+ )
+
+ val df2 = Seq(("a:1,b:2,c:3", "y")).toDF("a", "b")
+
+ checkAnswer(
+ df2.selectExpr("str_to_map(a)"),
+ Seq(Row(Map("a" -> "1", "b" -> "2", "c" -> "3")))
+ )
+ }
--- End diff --
Could you move this into `StringFunctionsSuite`? That is the same with
`DataFrameFunctionsSuite`, but has more string-related tests.
---
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]