Github user wzhfy commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12646#discussion_r118479213
  
    --- Diff: 
common/unsafe/src/test/java/org/apache/spark/unsafe/types/UTF8StringSuite.java 
---
    @@ -730,4 +726,60 @@ public void testToLong() throws IOException {
           assertFalse(negativeInput, 
UTF8String.fromString(negativeInput).toLong(wrapper));
         }
       }
    +  @Test
    +  public void trim() {
    +    assertEquals(fromString("hello"), fromString("  hello 
").trim(fromString(" ")));
    +    assertEquals(fromString("o"), fromString("  hello ").trim(fromString(" 
hle")));
    +    assertEquals(fromString("h e"), fromString("ooh e 
ooo").trim(fromString("o ")));
    +    assertEquals(fromString(""), 
fromString("ooo...oooo").trim(fromString("o.")));
    +    assertEquals(fromString("b"), 
fromString("%^b[]@").trim(fromString("][@^%")));
    +
    +    assertEquals(EMPTY_UTF8, fromString("  ").trim(fromString(" ")));
    +
    +    assertEquals(fromString("数据砖头"), fromString("  数据砖头 
").trim());
    +    assertEquals(fromString("数"), 
fromString("a数b").trim(fromString("ab")));
    +    assertEquals(fromString(""), 
fromString("a").trim(fromString("a数b")));
    +    assertEquals(fromString(""), fromString("数数 
数数数").trim(fromString("数 ")));
    +    assertEquals(fromString("据砖头"), fromString("数]数[数据ç 
–头#数数").trim(fromString("[数]#")));
    +    assertEquals(fromString("据砖头数数 "), fromString("数数数据ç 
–头数数 ").trim(fromString("数")));
    +  }
    +
    +  @Test
    +  public void trimLeft() {
    +    assertEquals(fromString("  hello "), fromString("  hello 
").trimLeft(fromString("")));
    +    assertEquals(fromString(""), 
fromString("a").trimLeft(fromString("a")));
    +    assertEquals(fromString("b"), 
fromString("b").trimLeft(fromString("a")));
    +    assertEquals(fromString("b"), 
fromString("b").trimLeft(fromString("a")));
    --- End diff --
    
    redundent


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