[ 
https://issues.apache.org/jira/browse/HADOOP-17430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17248020#comment-17248020
 ] 

Steve Loughran commented on HADOOP-17430:
-----------------------------------------

# worth pulling in [~belugabehr] on this
# This is going make the text length wrong

Could you submit this as a github PR, and add some tests to verify that 
everything works, including setting to an empty value after a long value is 
correct

> There is no way to clear Text bytes now
> ---------------------------------------
>
>                 Key: HADOOP-17430
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17430
>             Project: Hadoop Common
>          Issue Type: Wish
>          Components: common
>            Reporter: gaozhan ding
>            Priority: Minor
>         Attachments: Add_clear_logic_for_Text.patch
>
>
> In org.apache.hadoop.io.Text:clear() method, the comments show that we can 
> free the bytes by call set(new byte[0]), but it's not going to work now. 
> Maybe we can follow this comments.
>  
>  
> {code:java}
> // org.apache.hadoop.io.Text 
> /**
>  * Clear the string to empty.
>  *
>  * <em>Note</em>: For performance reasons, this call does not clear the
>  * underlying byte array that is retrievable via {@link #getBytes()}.
>  * In order to free the byte-array memory, call {@link #set(byte[])}
>  * with an empty byte array (For example, <code>new byte[0]</code>).
>  */
> public void clear() {
>   length = 0;
>   textLength = -1;
> }
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to