Github user chenghao-intel commented on a diff in the pull request: https://github.com/apache/spark/pull/6762#discussion_r33738817 --- Diff: unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java --- @@ -159,6 +162,77 @@ public UTF8String toLowerCase() { return UTF8String.fromString(toString().toLowerCase()); } + public UTF8String trim() { + return UTF8String.fromString(toString().trim()); + } + + public UTF8String trimLeft() { + return UTF8String.fromString(StringUtils.stripStart(toString(), " ")); + } + + public UTF8String trimRight() { + return UTF8String.fromString(StringUtils.stripEnd(toString(), " ")); + } + + public UTF8String reverse() { + return UTF8String.fromString(StringUtils.reverse(toString())); + } + + /** + * Returns the position of the first occurrence of substr in + * current string from the specified position (0-based index). + * + * @param v the string to be searched + * @param start the start position of the current string for searching + * @return the position of the first occurrence of substr, if not found, -1 returned. + */ + public int instr(UTF8String v, int start) { --- End diff -- Yeah, that's a good idea. Acutally I copied from Hive 0.13.1, which to avoid the encoding and decoding. After revisiting the code with the latest Hive, seems it changed as you described. I will update it.
--- 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