Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19222#discussion_r177687204
  
    --- 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 --
    
    weird, do you know why? they should be same logically.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to