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

    https://github.com/apache/spark/pull/21912#discussion_r213540247
  
    --- Diff: 
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeArrayData.java
 ---
    @@ -473,13 +473,13 @@ public static UnsafeArrayData fromPrimitiveArray(
         return result;
       }
     
    -  public static UnsafeArrayData forPrimitiveArray(int offset, int length, 
int elementSize) {
    -    return fromPrimitiveArray(null, offset, length, elementSize);
    +  public static UnsafeArrayData forPrimitiveArray(int length, int 
elementSize) {
    +    return fromPrimitiveArray(null, 0, length, elementSize);
    --- End diff --
    
    so this is used to create a new unsafe array with no data. This saves 
duplicated code, but we will do unnecessary memory copy.
    
    Shall we just add a new method in `UnsafeArrayData` to create a fresh array?


---

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

Reply via email to