hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo (Nicholas), SZE (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-9252) StringUtils.limitDecimalTo2(..) is unnecessarily synchronized
Date Sat, 02 Feb 2013 01:41:11 GMT

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

Tsz Wo (Nicholas), SZE commented on HADOOP-9252:
------------------------------------------------

Chris, thanks for the detail comparison.

> I'm assuming that for backwards-compatibility, StringUtils#limitDecimalTo2 still needs
to keep returning the same output after this patch. (If that's not the case, please let me
know.)

StringUtils#limitDecimalTo2 is @InterfaceAudience.Private and @InterfaceStability.Unstable
so that this is no compatibility issue.

The change probably will cause some HDFS/MapReduce tests to fail.  I intent to fix those failing
tests (if there is any) in separated JIRAs.

For 123 and 100.001, the output should be "123" and "100.00" since "123" is the exact value
and "100.00" indicates that there is a round off. The two trailing zeros at the end are also
significant figures.
                
> StringUtils.limitDecimalTo2(..) is unnecessarily synchronized
> -------------------------------------------------------------
>
>                 Key: HADOOP-9252
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9252
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: util
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Tsz Wo (Nicholas), SZE
>            Priority: Minor
>         Attachments: c9252_20130127.patch, c9252_20130128.patch
>
>
> limitDecimalTo2(double) currently uses decimalFormat, which is a static field, so that
it is synchronized.  Synchronization is unnecessary since it can simply uses String.format(..).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message