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

    https://github.com/apache/spark/pull/7551#discussion_r35072915
  
    --- Diff: 
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
 ---
    @@ -365,6 +368,36 @@ public InternalRow copy() {
         }
       }
     
    +  /**
    +   * Write this UnsafeRow's underlying bytes to the given OutputStream.
    +   *
    +   * @param out the stream to write to.
    +   * @param writeBuffer a byte array for buffering chunks of off-heap data 
while writing to the
    +   *                    output stream. If this row is backed by an on-heap 
byte array, then this
    +   *                    buffer will not be used and may be null.
    +   */
    +  public void writeToStream(OutputStream out, byte[] writeBuffer) throws 
IOException {
    +    if (baseObject instanceof byte[]) {
    +      int offsetInByteArray = (int) (PlatformDependent.BYTE_ARRAY_OFFSET - 
baseOffset);
    +      out.write((byte[]) baseObject, offsetInByteArray, sizeInBytes);
    --- End diff --
    
    Yes; `OutputStream.write()` is a `void` method.  It's `read` that you have 
to be careful with.


---
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