Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10820#discussion_r50783295
  
    --- Diff: 
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OnHeapColumnVector.java
 ---
    @@ -173,4 +232,86 @@ public final void putDoubles(int rowId, int count, 
byte[] src, int srcIndex) {
       public final double getDouble(int rowId) {
         return doubleData[rowId];
       }
    +
    +  //
    +  // APIs dealing with Arrays
    +  //
    +
    +  @Override
    +  public final int getArrayLength(int rowId) {
    +    return arrayLengths[rowId];
    +  }
    +  @Override
    +  public final int getArrayOffset(int rowId) {
    +    return arrayOffsets[rowId];
    +  }
    +
    +  @Override
    +  public final void putArray(int rowId, int offset, int length) {
    +    arrayOffsets[rowId] = offset;
    +    arrayLengths[rowId] = length;
    +  }
    +
    +  @Override
    +  public final void loadBytes(Array array) {
    +    array.byteArray = byteData;
    +    array.byteArrayOffset = array.offset;
    +  }
    +
    +  //
    +  // APIs dealing with Byte Arrays
    +  //
    +
    +  @Override
    +  public final int putByteArray(int rowId, byte[] value, int offset, int 
length) {
    +    int result = arrayData().appendBytes(length, value, offset);
    +    arrayOffsets[rowId] = result;
    +    arrayLengths[rowId] = length;
    +    return result;
    +  }
    +
    +  @Override
    +  public final void reserve(int requiredCapacity) {
    +    if (requiredCapacity > capacity) reserveInternal(requiredCapacity * 2);
    +  }
    +
    +  // Spilt this function out since it is the slow path.
    +  private final void reserveInternal(int newCapacity) {
    +    if (this.resultArray != null) {
    +      int[] newLengths = new int[newCapacity];
    +      int[] newOffsets = new int[newCapacity];
    +      if (this.arrayLengths != null) {
    +        System.arraycopy(this.arrayLengths, 0, newLengths, 0, 
elementsAppended);
    --- End diff --
    
    How does it compare to Unsafe.copyMemory()?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to