[ https://issues.apache.org/jira/browse/HIVE-2694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13186848#comment-13186848 ]
Phabricator commented on HIVE-2694: ----------------------------------- cwsteinbach has requested changes to the revision "HIVE-2694 [jira] Add FORMAT UDF". INLINE COMMENTS ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFormatNumber.java:65 Instead of string comparisons on the type name, please do the following to verify the types: * Verify that the two OIs are PrimitiveObjectInspectors. * Cast both OIs to PrimtiveObjectInspector and then validate the type in a switch statement using PrimitiveObjectInspector.getPrimitiveCategory(). ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFormatNumber.java:106 Let's make the StringBuilder a private instance variable and initialize it once in the constructor, and then clear it every time evaluate gets called: pattern.delete(0, pattern.length()) ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFormatNumber.java:139 I think it should only be necessary to construct a new DecimalFormat object when evaluate is called with a new dValue. Otherwise, it seems like it should be possible to reuse the DecimalFormat object from the previous evaluation. ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFormatNumber.java:114 This doesn't look right to me. It's not possible to construct a single pattern that tells DecimalFormat to use the grouping separator for thousands? REVISION DETAIL https://reviews.facebook.net/D1149 > Add FORMAT UDF > -------------- > > Key: HIVE-2694 > URL: https://issues.apache.org/jira/browse/HIVE-2694 > Project: Hive > Issue Type: New Feature > Components: UDF > Reporter: Carl Steinbach > Assignee: Zhenxiao Luo > Attachments: HIVE-2694.D1149.1.patch > > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira