Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6762#discussion_r33738885
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/StringFunctionsSuite.scala
 ---
    @@ -226,5 +226,128 @@ class StringFunctionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
         // checkEvaluation(StringLength(Literal.create(null, StringType)), 
null, create_row("abdef"))
       }
     
    +  test("TRIM/LTRIM/RTRIM") {
    +    val s = 'a.string.at(0)
    +    checkEvaluation(StringTrim(Literal(" aa  ")), "aa", create_row(" abdef 
"))
    +    checkEvaluation(StringTrim(s), "abdef", create_row(" abdef "))
    +
    +    checkEvaluation(StringTrimLeft(Literal(" aa  ")), "aa  ", create_row(" 
abdef "))
    +    checkEvaluation(StringTrimLeft(s), "abdef ", create_row(" abdef "))
    +
    +    checkEvaluation(StringTrimRight(Literal(" aa  ")), " aa", create_row(" 
abdef "))
    +    checkEvaluation(StringTrimRight(s), " abdef", create_row(" abdef "))
    +  }
    +
    +  test("FORMAT") {
    +    val f = 'f.string.at(0)
    +    val d1 = 'd.int.at(1)
    +    val s1 = 's.int.at(2)
    +
    +    val row1 = create_row("aa%d%s", 12, "cc")
    +    val row2 = create_row(null, 12, "cc")
    +    checkEvaluation(StringFormat(Literal("aa%d%s"), Literal(123), 
Literal("a")), "aa123a", row1)
    +    checkEvaluation(StringFormat(Literal("aa")), "aa", create_row(null))
    +    checkEvaluation(StringFormat(Literal("aa%d%s"), Literal(123), 
Literal("a")), "aa123a", row1)
    +
    +    checkEvaluation(StringFormat(f, d1, s1), "aa12cc", row1)
    +    checkEvaluation(StringFormat(f, d1, s1), null, row2)
    +  }
    +
    +  test("INSTR") {
    +    val s1 = 'a.string.at(0)
    --- End diff --
    
    Yes, I will do that.


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