Github user tarekauel commented on a diff in the pull request:
https://github.com/apache/spark/pull/7186#discussion_r34223797
--- Diff:
unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java ---
@@ -206,6 +206,30 @@ public UTF8String toLowerCase() {
return fromString(toString().toLowerCase());
}
+ /**
+ * Returns the index of the string `match` in this String. This string
has to be a comma separated
+ * list. If `match` contains a comma 0 will be returned. If the `match`
isn't part of this String,
+ * -1 will be returned, else the index of match (1-based index)
+ */
+ public int findInSet(UTF8String match) {
+ if (match.contains(UTF8String.fromString(","))) {
+ return 0;
+ }
+
+ int lastComma = -1;
+ for (int i = 0, n = 1; i < numBytes; i++) {
+ if (getByte(i) == 44) {
--- End diff --
One comment to this. 44 as bitstring is `00101100`
(http://www.fileformat.info/info/unicode/char/2c/index.htm). Just ASCII
characters can start with `00`, see https://en.wikipedia.org/wiki/UTF-8.
---
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]