Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/19222#discussion_r175865685
--- Diff:
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java ---
@@ -119,15 +115,24 @@ public static UTF8String blankString(int length) {
return fromBytes(spaces);
}
- protected UTF8String(Object base, long offset, int numBytes) {
+ protected UTF8String(byte[] bytes, long offset, int numBytes) {
+ this(new ByteArrayMemoryBlock(bytes, offset, numBytes));
+ }
+
+ public UTF8String(MemoryBlock base) {
this.base = base;
- this.offset = offset;
- this.numBytes = numBytes;
+ if (base != null) {
--- End diff --
`UTF8String(null)` is actually called for serialization. Thus, we cannot
replace `if` with `assert`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]