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

    https://github.com/apache/spark/pull/9016#discussion_r41570679
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnType.scala ---
    @@ -324,15 +296,18 @@ private[sql] object STRING extends 
NativeColumnType(StringType, 8) {
       }
     
       override def append(v: UTF8String, buffer: ByteBuffer): Unit = {
    -    val stringBytes = v.getBytes
    -    buffer.putInt(stringBytes.length).put(stringBytes, 0, 
stringBytes.length)
    +    buffer.putInt(v.numBytes())
    +    v.writeTo(buffer)
       }
     
       override def extract(buffer: ByteBuffer): UTF8String = {
         val length = buffer.getInt()
    -    val stringBytes = new Array[Byte](length)
    -    buffer.get(stringBytes, 0, length)
    -    UTF8String.fromBytes(stringBytes)
    +    assert(buffer.hasArray)
    --- End diff --
    
    ByteBuffer is used for getInt getLong, we could do the same without 
changing the interface.


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