Github user kevinyu98 commented on a diff in the pull request:
https://github.com/apache/spark/pull/12646#discussion_r77079247
--- Diff:
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java ---
@@ -488,6 +543,28 @@ public UTF8String trimLeft() {
}
}
+ /**
+ * Removes all specified trim character from the beginning of a string
+ * @param trimChar the trim character
+ */
+ public UTF8String trimLeft(UTF8String trimChar) {
+ int numTrimBytes = trimChar.numBytes;
+ if (numTrimBytes == 0) {
+ return this;
+ }
+ int s = 0;
+ // skip all the consecutive matching character in the left side
+ while(s < this.numBytes && s == this.find(trimChar, s)) {
+ s += numTrimBytes;
+ }
+ if (s == this.numBytes) {
+ // empty string
+ return UTF8String.fromBytes(new byte[0]);
--- End diff --
sure, I will change 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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]