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

    https://github.com/apache/spark/pull/9016#discussion_r41569273
  
    --- 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 --
    
    How about we just use a byte array and a int cursor to keep data in 
columnar cache instead of `ByteBuffer`?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to