Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/19222#discussion_r177511234
--- Diff:
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java ---
@@ -257,12 +258,13 @@ public long getPrefix() {
*/
public byte[] getBytes() {
// avoid copy if `base` is `byte[]`
- if (offset == BYTE_ARRAY_OFFSET && base instanceof byte[]
- && ((byte[]) base).length == numBytes) {
- return (byte[]) base;
+ long offset = base.getBaseOffset();
+ if (offset == BYTE_ARRAY_OFFSET && base instanceof ByteArrayMemoryBlock
+ && (((ByteArrayMemoryBlock) base).getByteArray()).length ==
numBytes) {
--- End diff --
This change caused some test failures, for example in `ColumnarBatchSuite`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]