HIVE-4174 [jira] Round UDF converts BigInts to double
AcceptedPublic

Press ? to show keyboard shortcuts.
Next Step
arc land 'HIVE-4174'
Author
chenchun
Reviewers
JIRA
njain
Lint
Lint OK
Unit
No Unit Test Coverage
Branch
HIVE-4174
Apply Patch
arc patch D9687
Arcanist Project
Restricted Arcanist Project
Subscribers
None
Projects
None
Summary

Round UDF return type be the same type as that of the first argument

Chen Chun pointed out on the hive-user mailing list that round() in Hive 0.10 returns

select round(cast(1234560 as BIGINT)), round(cast(12345670 as BIGINT)) from test limit 1;

//hive 0.10
1234560.0 1.234567E7

This is not consistent with MySQL(http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html#function_round)

which quotes

The return type is the same type as that of the first argument (assuming that it is integer, double, or decimal). This means that for an integer argument, the result is an integer (no decimal places)

Test Plan

EMPTY

njain accepted this revision.Via LegacyApr 3 2013, 6:50 AM

Revision Update History

DiffIDBaseDescriptionCreatedLintUnit
BaseBase
Diff 1304291457171Mar 25 2013, 3:59 PM

Local Commits

CommitTreeParentsAuthorSummaryDate
cf5c799943d79e77c455b8b9510e866c79d4chenchun
HIVE-4174 [jira] Round UDF converts BigInts to double (Show More…)
Mar 18 2013, 2:57 AM

Diff 30429

ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRound.java

Loading...

ql/src/test/queries/clientpositive/udf_round_3.q

Loading...

ql/src/test/results/clientpositive/udf_round.q.out

Loading...

ql/src/test/results/clientpositive/udf_round_3.q.out

Loading...

Add Comment