Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13990#discussion_r70562420
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ComplexTypeSuite.scala
 ---
    @@ -246,4 +246,26 @@ class ComplexTypeSuite extends SparkFunSuite with 
ExpressionEvalHelper {
         checkMetadata(CreateStructUnsafe(Seq(a, b)))
         checkMetadata(CreateNamedStructUnsafe(Seq("a", a, "b", b)))
       }
    +
    +  test("StringToMap") {
    +    val s0 = Literal("a:1,b:2,c:3")
    +    val m0 = Map("a" -> "1", "b" -> "2", "c" -> "3")
    +    checkEvaluation(new StringToMap(s0), m0)
    +
    +    val s1 = Literal("a: ,b:2")
    +    val m1 = Map("a" -> " ", "b" -> "2")
    +    checkEvaluation(new StringToMap(s1), m1)
    +
    +    val s2 = Literal("a=1,b=2,c=3")
    +    val m2 = Map("a" -> "1", "b" -> "2", "c" -> "3")
    +    checkEvaluation(StringToMap(s2, Literal(","), Literal("=")), m2)
    +
    +    val s3 = Literal("")
    +    val m3 = Map[String, String]("" -> null)
    +    checkEvaluation(StringToMap(s3, Literal(","), Literal("=")), m3)
    +
    +    val s4 = Literal("a:1_b:2_c:3")
    +    val m4 = Map("a" -> "1", "b" -> "2", "c" -> "3")
    +    checkEvaluation(new StringToMap(s4, Literal("_")), m4)
    --- End diff --
    
    can you add some type checking tests? you can follow other hive-fallback 
expressions to do this.


---
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]

Reply via email to