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

    https://github.com/apache/spark/pull/11477#discussion_r54853932
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala ---
    @@ -320,9 +320,11 @@ private[hive] trait HiveInspectors {
           case hvoi: HiveCharObjectInspector =>
             UTF8String.fromString(hvoi.getPrimitiveJavaObject(data).getValue)
           case x: StringObjectInspector if x.preferWritable() =>
    -        // Text is in UTF-8 already. No need to convert again via 
fromString
    +        // Text is in UTF-8 already. No need to convert again via 
fromString. Copy bytes
             val wObj = x.getPrimitiveWritableObject(data)
    -        UTF8String.fromBytes(wObj.getBytes, 0, wObj.getLength)
    +        val result = new Array[Byte](wObj.getLength())
    --- End diff --
    
    You can clone arrays with `.clone()`. Better yet, `Text` provides a 
`copyBytes()` method to return a copy of the bytes anyway.


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