aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java b/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
index 7abe0fa80a..4c28075bd9 100644
--- a/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
+++ b/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
@@ -850,11 +850,26 @@ public final class UTF8String implements Comparable<UTF8String>, Externalizable,
return fromString(sb.toString());
}
+ /**
+ * Wrapper over `long` to allow result of parsing long from string to be accessed via reference.
+ * This is done solely for better performance and is not expected to be used by end users.
+ */
public static class LongWrapper {
public long value = 0;
}
/**
+ * Wrapper over `int` to allow result of parsing integer from string to be accessed via reference.
+ * This is done solely for better performance and is not expected to be used by end users.
+ *
+ * {@link LongWrapper} could have been used here but using `int` directly save the extra cost of
+ * conversion from `long` -> `int`
+ */
+ public static class IntWrapper {
+ public int value = 0;
+ }
+
+ /**
* Parses this UTF8String to long.
*
* Note that, in this method we accumulate the result in negative format, and convert it to
@@ -942,10 +957,6 @@ public final class UTF8String implements Comparable<UTF8String>, Externalizable,
return true;
}
- public static class IntWrapper {
- public int value = 0;
- }
-
/**
* Parses this UTF8String to int.
*