hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phabricator (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-2694) Add FORMAT UDF
Date Fri, 20 Jan 2012 22:02:41 GMT

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

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:99 Cleaner
to take advantage of fall-through here, e.g:

  switch (..) {
   case VOID:
   case FLOAT:
   case DOUBLE:
     break;
   default:
    ...
  }
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFormatNumber.java:114 Fall-through
  ql/src/test/queries/clientpositive/udf_format_number.q:17 Please try formatting Double.MAX_VALUE
and Long.MAX_VALUE.

  ql/src/test/queries/clientpositive/udf_format_number.q:23 Please try formatting Double.MIN_VALUE
and Long.MIN_VALUE.
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFormatNumber.java:49 The MySQL
docs describe this function as follows:

  "FORMAT(X,D)

  Formats the number X to a format like '#,###,###.##', rounded to D decimal places, and returns
the result as a string. If D is 0, the result has no decimal point or fractional part."

  I think types in the current description (double, int) should be removed.

  Also, please make it clear in the doc string that this is intended to duplicated the functionality
of MySQL's FORMAT UDF.
  ql/src/test/results/clientnegative/udf_format_number_wrong3.q.out:1 Actually, I think it's
acceptable for the first argument to be an integer type. In that case the digits to the right
of the decimal point will always be zero. You can double check how the FORMAT UDF behaves
in MySQL if you doubt this.
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFormatNumber.java:101 The integer
types should also be acceptable. See my other comment below.
  ql/src/test/queries/clientpositive/udf_format_number.q:9 Also try formatting the values
0, 1, 12, 123, 1234

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, HIVE-2694.D1149.2.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

        

Mime
View raw message